File style cleanup for the SDL 2.0 release
This commit is contained in:
parent
2ac8624930
commit
0cb6385637
376 changed files with 17562 additions and 17773 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* accelerometer.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* accelerometer.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
@ -13,7 +13,7 @@
|
|||
#define FRICTION 0.0008f /* coefficient of acceleration that opposes direction of motion */
|
||||
#define GRAVITY_CONSTANT 0.004f /* how sensitive the ship is to the accelerometer */
|
||||
|
||||
/* If we aren't on an iPhone, then this definition ought to yield reasonable behavior */
|
||||
/* If we aren't on an iPhone, then this definition ought to yield reasonable behavior */
|
||||
#ifndef SDL_IPHONE_MAX_GFORCE
|
||||
#define SDL_IPHONE_MAX_GFORCE 5.0f
|
||||
#endif
|
||||
|
@ -48,7 +48,7 @@ render(SDL_Renderer *renderer)
|
|||
#define SINT16_MAX ((float)(0x7FFF))
|
||||
|
||||
/* update velocity from accelerometer
|
||||
the factor SDL_IPHONE_MAX_G_FORCE / SINT16_MAX converts between
|
||||
the factor SDL_IPHONE_MAX_G_FORCE / SINT16_MAX converts between
|
||||
SDL's units reported from the joytick, and units of g-force, as reported by the accelerometer
|
||||
*/
|
||||
shipData.vx +=
|
||||
|
@ -159,7 +159,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
|
||||
SDL_Window *window; /* main window */
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Renderer *renderer;
|
||||
Uint32 startFrame; /* time frame began to process */
|
||||
Uint32 endFrame; /* time frame ended processing */
|
||||
Uint32 delay; /* time to pause waiting to draw next frame */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* common.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* common.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
@ -9,8 +9,8 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
Produces a random int x, min <= x <= max
|
||||
following a uniform distribution
|
||||
Produces a random int x, min <= x <= max
|
||||
following a uniform distribution
|
||||
*/
|
||||
int
|
||||
randomInt(int min, int max)
|
||||
|
@ -19,8 +19,8 @@ randomInt(int min, int max)
|
|||
}
|
||||
|
||||
/*
|
||||
Produces a random float x, min <= x <= max
|
||||
following a uniform distribution
|
||||
Produces a random float x, min <= x <= max
|
||||
following a uniform distribution
|
||||
*/
|
||||
float
|
||||
randomFloat(float min, float max)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* common.h
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* common.h
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#define SCREEN_WIDTH 320
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* fireworks.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* fireworks.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
@ -17,11 +17,11 @@
|
|||
|
||||
static GLuint particleTextureID; /* OpenGL particle texture id */
|
||||
static SDL_bool pointSizeExtensionSupported; /* is GL_OES_point_size_array supported ? */
|
||||
/*
|
||||
used to describe what type of particle a given struct particle is.
|
||||
emitter - this particle flies up, shooting off trail particles, then finally explodes into dust particles.
|
||||
trail - shoots off, following emitter particle
|
||||
dust - radiates outwards from emitter explosion
|
||||
/*
|
||||
used to describe what type of particle a given struct particle is.
|
||||
emitter - this particle flies up, shooting off trail particles, then finally explodes into dust particles.
|
||||
trail - shoots off, following emitter particle
|
||||
dust - radiates outwards from emitter explosion
|
||||
*/
|
||||
enum particleType
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ enum particleType
|
|||
dust
|
||||
};
|
||||
/*
|
||||
struct particle is used to describe each particle displayed on screen
|
||||
struct particle is used to describe each particle displayed on screen
|
||||
*/
|
||||
struct particle
|
||||
{
|
||||
|
@ -57,8 +57,8 @@ int nextPowerOfTwo(int x);
|
|||
void drawParticles();
|
||||
void stepParticles(void);
|
||||
|
||||
/* helper function (used in texture loading)
|
||||
returns next power of two greater than or equal to x
|
||||
/* helper function (used in texture loading)
|
||||
returns next power of two greater than or equal to x
|
||||
*/
|
||||
int
|
||||
nextPowerOfTwo(int x)
|
||||
|
@ -70,8 +70,8 @@ nextPowerOfTwo(int x)
|
|||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
steps each active particle by timestep MILLESECONDS_PER_FRAME
|
||||
/*
|
||||
steps each active particle by timestep MILLESECONDS_PER_FRAME
|
||||
*/
|
||||
void
|
||||
stepParticles(void)
|
||||
|
@ -145,13 +145,13 @@ stepParticles(void)
|
|||
curr++;
|
||||
}
|
||||
/* the number of active particles is computed as the difference between
|
||||
old number of active particles, where slot points, and the
|
||||
old number of active particles, where slot points, and the
|
||||
new size of the array, where particles points */
|
||||
num_active_particles = slot - particles;
|
||||
}
|
||||
|
||||
/*
|
||||
This draws all the particles shown on screen
|
||||
This draws all the particles shown on screen
|
||||
*/
|
||||
void
|
||||
drawParticles()
|
||||
|
@ -177,7 +177,7 @@ drawParticles()
|
|||
}
|
||||
|
||||
/*
|
||||
This causes an emitter to explode in a circular bloom of dust particles
|
||||
This causes an emitter to explode in a circular bloom of dust particles
|
||||
*/
|
||||
void
|
||||
explodeEmitter(struct particle *emitter)
|
||||
|
@ -219,7 +219,7 @@ explodeEmitter(struct particle *emitter)
|
|||
}
|
||||
|
||||
/*
|
||||
This spawns a trail particle from an emitter
|
||||
This spawns a trail particle from an emitter
|
||||
*/
|
||||
void
|
||||
spawnTrailFromEmitter(struct particle *emitter)
|
||||
|
@ -254,7 +254,7 @@ spawnTrailFromEmitter(struct particle *emitter)
|
|||
}
|
||||
|
||||
/*
|
||||
spawns a new emitter particle at the bottom of the screen
|
||||
spawns a new emitter particle at the bottom of the screen
|
||||
destined for the point (x,y).
|
||||
*/
|
||||
void
|
||||
|
@ -313,7 +313,7 @@ initializeParticles(void)
|
|||
}
|
||||
|
||||
/*
|
||||
loads the particle texture
|
||||
loads the particle texture
|
||||
*/
|
||||
void
|
||||
initializeTexture()
|
||||
|
@ -375,7 +375,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
/* seed the random number generator */
|
||||
srand(time(NULL));
|
||||
/*
|
||||
/*
|
||||
request some OpenGL parameters
|
||||
that may speed drawing
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* happy.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* happy.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
@ -20,8 +20,8 @@ static struct
|
|||
} faces[NUM_HAPPY_FACES];
|
||||
|
||||
/*
|
||||
Sets initial positions and velocities of happyfaces
|
||||
units of velocity are pixels per millesecond
|
||||
Sets initial positions and velocities of happyfaces
|
||||
units of velocity are pixels per millesecond
|
||||
*/
|
||||
void
|
||||
initializeHappyFaces()
|
||||
|
@ -94,7 +94,7 @@ render(SDL_Renderer *renderer)
|
|||
}
|
||||
|
||||
/*
|
||||
loads the happyface graphic into a texture
|
||||
loads the happyface graphic into a texture
|
||||
*/
|
||||
void
|
||||
initializeTexture(SDL_Renderer *renderer)
|
||||
|
@ -125,7 +125,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Renderer *renderer;
|
||||
Uint32 startFrame;
|
||||
Uint32 endFrame;
|
||||
Uint32 delay;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* keyboard.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* keyboard.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#import "SDL.h"
|
||||
|
@ -97,14 +97,14 @@ fontMapping map[TABLE_SIZE] = {
|
|||
};
|
||||
|
||||
/*
|
||||
This function maps an SDL_KeySym to an index in the bitmap font.
|
||||
It does so by scanning through the font mapping table one entry
|
||||
at a time.
|
||||
|
||||
If a match is found (scancode and allowed modifiers), the proper
|
||||
index is returned.
|
||||
|
||||
If there is no entry for the key, -1 is returned
|
||||
This function maps an SDL_KeySym to an index in the bitmap font.
|
||||
It does so by scanning through the font mapping table one entry
|
||||
at a time.
|
||||
|
||||
If a match is found (scancode and allowed modifiers), the proper
|
||||
index is returned.
|
||||
|
||||
If there is no entry for the key, -1 is returned
|
||||
*/
|
||||
int
|
||||
keyToIndex(SDL_Keysym key)
|
||||
|
@ -125,8 +125,8 @@ keyToIndex(SDL_Keysym key)
|
|||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
This function returns and x,y position for a given character number.
|
||||
/*
|
||||
This function returns and x,y position for a given character number.
|
||||
It is used for positioning each character of text
|
||||
*/
|
||||
void
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* mixer.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* mixer.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#import "SDL.h"
|
||||
|
@ -100,7 +100,7 @@ loadSound(const char *file, struct sound *s)
|
|||
if (result == -1) {
|
||||
fatalError("could not build audio CVT");
|
||||
} else if (result != 0) {
|
||||
/*
|
||||
/*
|
||||
this happens when the .wav format differs from the output format.
|
||||
we convert the .wav buffer here
|
||||
*/
|
||||
|
@ -179,8 +179,8 @@ render(SDL_Renderer *renderer)
|
|||
}
|
||||
|
||||
/*
|
||||
finds a sound channel in the mixer for a sound
|
||||
and sets it up to start playing
|
||||
finds a sound channel in the mixer for a sound
|
||||
and sets it up to start playing
|
||||
*/
|
||||
int
|
||||
playSound(struct sound *s)
|
||||
|
@ -225,9 +225,9 @@ playSound(struct sound *s)
|
|||
return selected_channel;
|
||||
}
|
||||
|
||||
/*
|
||||
Called from SDL's audio system. Supplies sound input with data by mixing together all
|
||||
currently playing sound effects.
|
||||
/*
|
||||
Called from SDL's audio system. Supplies sound input with data by mixing together all
|
||||
currently playing sound effects.
|
||||
*/
|
||||
void
|
||||
audioCallback(void *userdata, Uint8 * stream, int len)
|
||||
|
@ -273,7 +273,7 @@ main(int argc, char *argv[])
|
|||
|
||||
int done; /* has user tried to quit ? */
|
||||
SDL_Window *window; /* main window */
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Event event;
|
||||
Uint32 startFrame; /* holds when frame started processing */
|
||||
Uint32 endFrame; /* holds when frame ended processing */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* rectangles.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* rectangles.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
@ -39,7 +39,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Renderer *renderer;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
|
||||
|
@ -59,7 +59,7 @@ main(int argc, char *argv[])
|
|||
fatalError("Could not initialize Window");
|
||||
}
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
if (!renderer) {
|
||||
if (!renderer) {
|
||||
fatalError("Could not create renderer");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* touch.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* touch.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
@ -14,8 +14,8 @@
|
|||
static SDL_Texture *brush = 0; /* texture for the brush */
|
||||
|
||||
/*
|
||||
draws a line from (startx, starty) to (startx + dx, starty + dy)
|
||||
this is accomplished by drawing several blots spaced PIXELS_PER_ITERATION apart
|
||||
draws a line from (startx, starty) to (startx + dx, starty + dy)
|
||||
this is accomplished by drawing several blots spaced PIXELS_PER_ITERATION apart
|
||||
*/
|
||||
void
|
||||
drawLine(SDL_Renderer *renderer, float startx, float starty, float dx, float dy)
|
||||
|
@ -48,7 +48,7 @@ drawLine(SDL_Renderer *renderer, float startx, float starty, float dx, float dy)
|
|||
}
|
||||
|
||||
/*
|
||||
loads the brush texture
|
||||
loads the brush texture
|
||||
*/
|
||||
void
|
||||
initializeTexture(SDL_Renderer *renderer)
|
||||
|
@ -78,7 +78,7 @@ main(int argc, char *argv[])
|
|||
Uint8 state; /* mouse (touch) state */
|
||||
SDL_Event event;
|
||||
SDL_Window *window; /* main window */
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Renderer *renderer;
|
||||
int done; /* does user want to quit? */
|
||||
|
||||
/* initialize SDL */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* rectangles.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
* rectangles.c
|
||||
* written by Holmes Futrell
|
||||
* use however you want
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -14,52 +14,52 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
if (screen == NULL) {
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
video_bpp, SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -14,52 +14,52 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
if (screen == NULL) {
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
video_bpp, SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -63,37 +63,37 @@ static double mtime(void)
|
|||
{
|
||||
struct timeval tk_time;
|
||||
struct timezone tz;
|
||||
|
||||
|
||||
gettimeofday(&tk_time, &tz);
|
||||
|
||||
|
||||
return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
|
||||
}
|
||||
|
||||
static double filter(double in, double *save)
|
||||
{
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
|
||||
save[3] = in;
|
||||
save[1] = save[0]*k1 + k2*(save[3] + save[2]);
|
||||
save[3] = in;
|
||||
save[1] = save[0]*k1 + k2*(save[3] + save[2]);
|
||||
|
||||
save[0]=save[1];
|
||||
save[2]=save[3];
|
||||
save[0]=save[1];
|
||||
save[2]=save[3];
|
||||
|
||||
return(save[1]);
|
||||
return(save[1]);
|
||||
}
|
||||
|
||||
void DrawStr(const char *str)
|
||||
{
|
||||
GLint i = 0;
|
||||
|
||||
if(!str) return;
|
||||
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
GLint i = 0;
|
||||
|
||||
if(!str) return;
|
||||
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -168,9 +168,9 @@ Atlantis_Init(void)
|
|||
InitFishs();
|
||||
|
||||
glEnable(GL_FOG);
|
||||
glFogi(GL_FOG_MODE, GL_EXP);
|
||||
glFogf(GL_FOG_DENSITY, 0.0000025);
|
||||
glFogfv(GL_FOG_COLOR, fog_color);
|
||||
glFogi(GL_FOG_MODE, GL_EXP);
|
||||
glFogf(GL_FOG_DENSITY, 0.0000025);
|
||||
glFogfv(GL_FOG_COLOR, fog_color);
|
||||
|
||||
glClearColor(0.0, 0.5, 0.9, 1.0);
|
||||
}
|
||||
|
@ -178,9 +178,9 @@ Atlantis_Init(void)
|
|||
void
|
||||
Atlantis_Reshape(int width, int height)
|
||||
{
|
||||
w_win = width;
|
||||
h_win = height;
|
||||
|
||||
w_win = width;
|
||||
h_win = height;
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -212,37 +212,37 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
{
|
||||
switch (key) {
|
||||
case 't':
|
||||
Timing = !Timing;
|
||||
Timing = !Timing;
|
||||
break;
|
||||
case ' ':
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case GL_VENDOR:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case GL_VERSION:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case GL_VENDOR:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case GL_VERSION:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 27: /* Esc will quit */
|
||||
exit(1);
|
||||
break;
|
||||
case 's': /* "s" start animation */
|
||||
case 's': /* "s" start animation */
|
||||
moving = GL_TRUE;
|
||||
//glutIdleFunc(Animate);
|
||||
break;
|
||||
case 'a': /* "a" stop animation */
|
||||
case 'a': /* "a" stop animation */
|
||||
moving = GL_FALSE;
|
||||
//glutIdleFunc(NULL);
|
||||
break;
|
||||
case '.': /* "." will advance frame */
|
||||
case '.': /* "." will advance frame */
|
||||
if (!moving) {
|
||||
Atlantis_Animate();
|
||||
}
|
||||
|
@ -251,21 +251,21 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
/*
|
||||
void Display(void)
|
||||
{
|
||||
static float P123[3] = {-448.94, -203.14, 9499.60};
|
||||
static float P124[3] = {-442.64, -185.20, 9528.07};
|
||||
static float P125[3] = {-441.07, -148.05, 9528.07};
|
||||
static float P126[3] = {-443.43, -128.84, 9499.60};
|
||||
static float P127[3] = {-456.87, -146.78, 9466.67};
|
||||
static float P128[3] = {-453.68, -183.93, 9466.67};
|
||||
static float P123[3] = {-448.94, -203.14, 9499.60};
|
||||
static float P124[3] = {-442.64, -185.20, 9528.07};
|
||||
static float P125[3] = {-441.07, -148.05, 9528.07};
|
||||
static float P126[3] = {-443.43, -128.84, 9499.60};
|
||||
static float P127[3] = {-456.87, -146.78, 9466.67};
|
||||
static float P128[3] = {-453.68, -183.93, 9466.67};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
FishTransform(&dolph);
|
||||
DrawDolphin(&dolph);
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -274,9 +274,9 @@ Atlantis_Display(void)
|
|||
{
|
||||
int i;
|
||||
static double th[4] = {0.0, 0.0, 0.0, 0.0};
|
||||
static double t1 = 0.0, t2 = 0.0, t;
|
||||
char num_str[128];
|
||||
|
||||
static double t1 = 0.0, t2 = 0.0, t;
|
||||
char num_str[128];
|
||||
|
||||
t1 = t2;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
@ -303,56 +303,56 @@ Atlantis_Display(void)
|
|||
glScalef(0.45, 0.45, 0.3);
|
||||
DrawWhale(&babyWhale);
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
if(Timing)
|
||||
{
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glColor3f(1.0, 0.0, 0.0);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
|
||||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glColor3f(1.0, 0.0, 0.0);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
|
||||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
glutSwapBuffers();
|
||||
|
@ -377,18 +377,18 @@ timingSelect(int value)
|
|||
{
|
||||
switch(value)
|
||||
{
|
||||
case 1:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case 2:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case 3:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case 4:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
case 1:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case 2:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case 3:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case 4:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,24 +413,24 @@ menuSelect(int value)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
GLboolean fullscreen = GL_FALSE;
|
||||
GLint time_menu;
|
||||
|
||||
srand(0);
|
||||
GLboolean fullscreen = GL_FALSE;
|
||||
GLint time_menu;
|
||||
|
||||
srand(0);
|
||||
|
||||
glutInit(&argc, argv);
|
||||
if (argc > 1 && !strcmp(argv[1], "-w"))
|
||||
fullscreen = GL_FALSE;
|
||||
if (argc > 1 && !strcmp(argv[1], "-w"))
|
||||
fullscreen = GL_FALSE;
|
||||
|
||||
//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitDisplayString("rgba double depth=24");
|
||||
if (fullscreen) {
|
||||
glutGameModeString("1024x768:32");
|
||||
glutEnterGameMode();
|
||||
} else {
|
||||
glutInitWindowSize(320, 240);
|
||||
glutCreateWindow("Atlantis Timing");
|
||||
}
|
||||
//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitDisplayString("rgba double depth=24");
|
||||
if (fullscreen) {
|
||||
glutGameModeString("1024x768:32");
|
||||
glutEnterGameMode();
|
||||
} else {
|
||||
glutInitWindowSize(320, 240);
|
||||
glutCreateWindow("Atlantis Timing");
|
||||
}
|
||||
Init();
|
||||
glutDisplayFunc(Display);
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@ -438,19 +438,19 @@ main(int argc, char **argv)
|
|||
moving = GL_TRUE;
|
||||
glutIdleFunc(Animate);
|
||||
glutVisibilityFunc(Visible);
|
||||
|
||||
|
||||
time_menu = glutCreateMenu(timingSelect);
|
||||
glutAddMenuEntry("GL_VENDOR", 1);
|
||||
glutAddMenuEntry("GL_RENDERER", 2);
|
||||
glutAddMenuEntry("GL_VERSION", 3);
|
||||
glutAddMenuEntry("GL_EXTENSIONS", 4);
|
||||
|
||||
|
||||
glutCreateMenu(menuSelect);
|
||||
glutAddMenuEntry("Start motion", 1);
|
||||
glutAddMenuEntry("Stop motion", 2);
|
||||
glutAddSubMenu("Timing Mode", time_menu);
|
||||
glutAddMenuEntry("Quit", 4);
|
||||
|
||||
|
||||
//glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
glutMainLoop();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -22,18 +22,18 @@ static SDL_Surface *gScreen;
|
|||
static void initAttributes ()
|
||||
{
|
||||
// Setup attributes we want for the OpenGL context
|
||||
|
||||
|
||||
int value;
|
||||
|
||||
|
||||
// Don't set color bit sizes (SDL_GL_RED_SIZE, etc)
|
||||
// Mac OS X will always use 8-8-8-8 ARGB for 32-bit screens and
|
||||
// 5-5-5 RGB for 16-bit screens
|
||||
|
||||
|
||||
// Request a 16-bit depth buffer (without this, there is no depth buffer)
|
||||
value = 16;
|
||||
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, value);
|
||||
|
||||
|
||||
|
||||
|
||||
// Request double-buffered OpenGL
|
||||
// The fact that windows are double-buffered on Mac OS X has no effect
|
||||
// on OpenGL double buffering.
|
||||
|
@ -46,41 +46,41 @@ static void printAttributes ()
|
|||
// Print out attributes of the context we created
|
||||
int nAttr;
|
||||
int i;
|
||||
|
||||
|
||||
int attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
|
||||
SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE };
|
||||
|
||||
|
||||
char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n", "Green size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Depth bufer size: %d bits\n" };
|
||||
|
||||
nAttr = sizeof(attr) / sizeof(int);
|
||||
|
||||
|
||||
for (i = 0; i < nAttr; i++) {
|
||||
|
||||
|
||||
int value;
|
||||
SDL_GL_GetAttribute (attr[i], &value);
|
||||
printf (desc[i], value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void createSurface (int fullscreen)
|
||||
{
|
||||
Uint32 flags = 0;
|
||||
|
||||
|
||||
flags = SDL_OPENGL;
|
||||
if (fullscreen)
|
||||
flags |= SDL_FULLSCREEN;
|
||||
|
||||
|
||||
// Create window
|
||||
gScreen = SDL_SetVideoMode (640, 480, 0, flags);
|
||||
if (gScreen == NULL) {
|
||||
|
||||
|
||||
fprintf (stderr, "Couldn't set 640x480 OpenGL video mode: %s\n",
|
||||
SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
static void initGL ()
|
||||
|
@ -100,30 +100,30 @@ static void mainLoop ()
|
|||
SDL_Event event;
|
||||
int done = 0;
|
||||
int fps = 24;
|
||||
int delay = 1000/fps;
|
||||
int delay = 1000/fps;
|
||||
int thenTicks = -1;
|
||||
int nowTicks;
|
||||
|
||||
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent (&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent (&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw at 24 hz
|
||||
// This approach is not normally recommended - it is better to
|
||||
// use time-based animation and run as fast as possible
|
||||
|
@ -144,36 +144,36 @@ static void mainLoop ()
|
|||
}
|
||||
|
||||
SDL_Delay (delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Init SDL video subsystem
|
||||
if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
|
||||
|
||||
// Init SDL video subsystem
|
||||
if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
|
||||
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Set GL context attributes
|
||||
initAttributes ();
|
||||
|
||||
|
||||
// Create GL context
|
||||
createSurface (0);
|
||||
|
||||
|
||||
// Get GL context attributes
|
||||
printAttributes ();
|
||||
|
||||
|
||||
// Init GL state
|
||||
initGL ();
|
||||
|
||||
|
||||
// Draw, get events...
|
||||
mainLoop ();
|
||||
|
||||
|
||||
// Cleanup
|
||||
SDL_Quit();
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -14,52 +14,52 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
if (screen == NULL) {
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
video_bpp, SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -14,52 +14,52 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
if (screen == NULL) {
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
video_bpp, SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -63,37 +63,37 @@ static double mtime(void)
|
|||
{
|
||||
struct timeval tk_time;
|
||||
struct timezone tz;
|
||||
|
||||
|
||||
gettimeofday(&tk_time, &tz);
|
||||
|
||||
|
||||
return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
|
||||
}
|
||||
|
||||
static double filter(double in, double *save)
|
||||
{
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
|
||||
save[3] = in;
|
||||
save[1] = save[0]*k1 + k2*(save[3] + save[2]);
|
||||
save[3] = in;
|
||||
save[1] = save[0]*k1 + k2*(save[3] + save[2]);
|
||||
|
||||
save[0]=save[1];
|
||||
save[2]=save[3];
|
||||
save[0]=save[1];
|
||||
save[2]=save[3];
|
||||
|
||||
return(save[1]);
|
||||
return(save[1]);
|
||||
}
|
||||
|
||||
void DrawStr(const char *str)
|
||||
{
|
||||
GLint i = 0;
|
||||
|
||||
if(!str) return;
|
||||
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
GLint i = 0;
|
||||
|
||||
if(!str) return;
|
||||
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -168,9 +168,9 @@ Atlantis_Init(void)
|
|||
InitFishs();
|
||||
|
||||
glEnable(GL_FOG);
|
||||
glFogi(GL_FOG_MODE, GL_EXP);
|
||||
glFogf(GL_FOG_DENSITY, 0.0000025);
|
||||
glFogfv(GL_FOG_COLOR, fog_color);
|
||||
glFogi(GL_FOG_MODE, GL_EXP);
|
||||
glFogf(GL_FOG_DENSITY, 0.0000025);
|
||||
glFogfv(GL_FOG_COLOR, fog_color);
|
||||
|
||||
glClearColor(0.0, 0.5, 0.9, 1.0);
|
||||
}
|
||||
|
@ -178,9 +178,9 @@ Atlantis_Init(void)
|
|||
void
|
||||
Atlantis_Reshape(int width, int height)
|
||||
{
|
||||
w_win = width;
|
||||
h_win = height;
|
||||
|
||||
w_win = width;
|
||||
h_win = height;
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -212,37 +212,37 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
{
|
||||
switch (key) {
|
||||
case 't':
|
||||
Timing = !Timing;
|
||||
Timing = !Timing;
|
||||
break;
|
||||
case ' ':
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case GL_VENDOR:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case GL_VERSION:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case GL_VENDOR:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case GL_VERSION:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 27: /* Esc will quit */
|
||||
exit(1);
|
||||
break;
|
||||
case 's': /* "s" start animation */
|
||||
case 's': /* "s" start animation */
|
||||
moving = GL_TRUE;
|
||||
//glutIdleFunc(Animate);
|
||||
break;
|
||||
case 'a': /* "a" stop animation */
|
||||
case 'a': /* "a" stop animation */
|
||||
moving = GL_FALSE;
|
||||
//glutIdleFunc(NULL);
|
||||
break;
|
||||
case '.': /* "." will advance frame */
|
||||
case '.': /* "." will advance frame */
|
||||
if (!moving) {
|
||||
Atlantis_Animate();
|
||||
}
|
||||
|
@ -251,21 +251,21 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
/*
|
||||
void Display(void)
|
||||
{
|
||||
static float P123[3] = {-448.94, -203.14, 9499.60};
|
||||
static float P124[3] = {-442.64, -185.20, 9528.07};
|
||||
static float P125[3] = {-441.07, -148.05, 9528.07};
|
||||
static float P126[3] = {-443.43, -128.84, 9499.60};
|
||||
static float P127[3] = {-456.87, -146.78, 9466.67};
|
||||
static float P128[3] = {-453.68, -183.93, 9466.67};
|
||||
static float P123[3] = {-448.94, -203.14, 9499.60};
|
||||
static float P124[3] = {-442.64, -185.20, 9528.07};
|
||||
static float P125[3] = {-441.07, -148.05, 9528.07};
|
||||
static float P126[3] = {-443.43, -128.84, 9499.60};
|
||||
static float P127[3] = {-456.87, -146.78, 9466.67};
|
||||
static float P128[3] = {-453.68, -183.93, 9466.67};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
FishTransform(&dolph);
|
||||
DrawDolphin(&dolph);
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -274,9 +274,9 @@ Atlantis_Display(void)
|
|||
{
|
||||
int i;
|
||||
static double th[4] = {0.0, 0.0, 0.0, 0.0};
|
||||
static double t1 = 0.0, t2 = 0.0, t;
|
||||
char num_str[128];
|
||||
|
||||
static double t1 = 0.0, t2 = 0.0, t;
|
||||
char num_str[128];
|
||||
|
||||
t1 = t2;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
@ -303,56 +303,56 @@ Atlantis_Display(void)
|
|||
glScalef(0.45, 0.45, 0.3);
|
||||
DrawWhale(&babyWhale);
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
if(Timing)
|
||||
{
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glColor3f(1.0, 0.0, 0.0);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
|
||||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glColor3f(1.0, 0.0, 0.0);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
|
||||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
glutSwapBuffers();
|
||||
|
@ -377,18 +377,18 @@ timingSelect(int value)
|
|||
{
|
||||
switch(value)
|
||||
{
|
||||
case 1:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case 2:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case 3:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case 4:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
case 1:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case 2:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case 3:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case 4:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,24 +413,24 @@ menuSelect(int value)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
GLboolean fullscreen = GL_FALSE;
|
||||
GLint time_menu;
|
||||
|
||||
srand(0);
|
||||
GLboolean fullscreen = GL_FALSE;
|
||||
GLint time_menu;
|
||||
|
||||
srand(0);
|
||||
|
||||
glutInit(&argc, argv);
|
||||
if (argc > 1 && !strcmp(argv[1], "-w"))
|
||||
fullscreen = GL_FALSE;
|
||||
if (argc > 1 && !strcmp(argv[1], "-w"))
|
||||
fullscreen = GL_FALSE;
|
||||
|
||||
//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitDisplayString("rgba double depth=24");
|
||||
if (fullscreen) {
|
||||
glutGameModeString("1024x768:32");
|
||||
glutEnterGameMode();
|
||||
} else {
|
||||
glutInitWindowSize(320, 240);
|
||||
glutCreateWindow("Atlantis Timing");
|
||||
}
|
||||
//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitDisplayString("rgba double depth=24");
|
||||
if (fullscreen) {
|
||||
glutGameModeString("1024x768:32");
|
||||
glutEnterGameMode();
|
||||
} else {
|
||||
glutInitWindowSize(320, 240);
|
||||
glutCreateWindow("Atlantis Timing");
|
||||
}
|
||||
Init();
|
||||
glutDisplayFunc(Display);
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@ -438,19 +438,19 @@ main(int argc, char **argv)
|
|||
moving = GL_TRUE;
|
||||
glutIdleFunc(Animate);
|
||||
glutVisibilityFunc(Visible);
|
||||
|
||||
|
||||
time_menu = glutCreateMenu(timingSelect);
|
||||
glutAddMenuEntry("GL_VENDOR", 1);
|
||||
glutAddMenuEntry("GL_RENDERER", 2);
|
||||
glutAddMenuEntry("GL_VERSION", 3);
|
||||
glutAddMenuEntry("GL_EXTENSIONS", 4);
|
||||
|
||||
|
||||
glutCreateMenu(menuSelect);
|
||||
glutAddMenuEntry("Start motion", 1);
|
||||
glutAddMenuEntry("Stop motion", 2);
|
||||
glutAddSubMenu("Timing Mode", time_menu);
|
||||
glutAddMenuEntry("Quit", 4);
|
||||
|
||||
|
||||
//glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
glutMainLoop();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -22,18 +22,18 @@ static SDL_Surface *gScreen;
|
|||
static void initAttributes ()
|
||||
{
|
||||
// Setup attributes we want for the OpenGL context
|
||||
|
||||
|
||||
int value;
|
||||
|
||||
|
||||
// Don't set color bit sizes (SDL_GL_RED_SIZE, etc)
|
||||
// Mac OS X will always use 8-8-8-8 ARGB for 32-bit screens and
|
||||
// 5-5-5 RGB for 16-bit screens
|
||||
|
||||
|
||||
// Request a 16-bit depth buffer (without this, there is no depth buffer)
|
||||
value = 16;
|
||||
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, value);
|
||||
|
||||
|
||||
|
||||
|
||||
// Request double-buffered OpenGL
|
||||
// The fact that windows are double-buffered on Mac OS X has no effect
|
||||
// on OpenGL double buffering.
|
||||
|
@ -46,36 +46,36 @@ static void printAttributes ()
|
|||
// Print out attributes of the context we created
|
||||
int nAttr;
|
||||
int i;
|
||||
|
||||
|
||||
int attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
|
||||
SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE };
|
||||
|
||||
|
||||
char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n", "Green size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Depth bufer size: %d bits\n" };
|
||||
|
||||
nAttr = sizeof(attr) / sizeof(int);
|
||||
|
||||
|
||||
for (i = 0; i < nAttr; i++) {
|
||||
|
||||
|
||||
int value;
|
||||
SDL_GL_GetAttribute (attr[i], &value);
|
||||
printf (desc[i], value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void createSurface (int fullscreen)
|
||||
{
|
||||
Uint32 flags = 0;
|
||||
|
||||
|
||||
flags = SDL_OPENGL;
|
||||
if (fullscreen)
|
||||
flags |= SDL_FULLSCREEN;
|
||||
|
||||
|
||||
// Create window
|
||||
gScreen = SDL_SetVideoMode (640, 480, 0, flags);
|
||||
if (gScreen == NULL) {
|
||||
|
||||
|
||||
fprintf (stderr, "Couldn't set 640x480 OpenGL video mode: %s\n",
|
||||
SDL_GetError());
|
||||
SDL_Quit();
|
||||
|
@ -103,7 +103,7 @@ static void mainLoop ()
|
|||
int delay = 1000/fps;
|
||||
int thenTicks = -1;
|
||||
int nowTicks;
|
||||
|
||||
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
|
@ -123,7 +123,7 @@ static void mainLoop ()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Draw at 24 hz
|
||||
// This approach is not normally recommended - it is better to
|
||||
// use time-based animation and run as fast as possible
|
||||
|
@ -151,7 +151,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
// Init SDL video subsystem
|
||||
if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
|
||||
|
||||
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
|
@ -159,19 +159,19 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Set GL context attributes
|
||||
initAttributes ();
|
||||
|
||||
|
||||
// Create GL context
|
||||
createSurface (0);
|
||||
|
||||
|
||||
// Get GL context attributes
|
||||
printAttributes ();
|
||||
|
||||
|
||||
// Init GL state
|
||||
initGL ();
|
||||
|
||||
|
||||
// Draw, get events...
|
||||
mainLoop ();
|
||||
|
||||
|
||||
// Cleanup
|
||||
SDL_Quit();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -14,52 +14,52 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
if (screen == NULL) {
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
video_bpp, SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -14,52 +14,52 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
Uint8 video_bpp = 0;
|
||||
Uint32 videoflags = SDL_SWSURFACE;
|
||||
int done;
|
||||
SDL_Event event;
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
/* Set 640x480 video mode */
|
||||
screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
|
||||
if (screen == NULL) {
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
|
||||
video_bpp, SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
done = 0;
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent(&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the SDL library */
|
||||
SDL_Quit();
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -63,37 +63,37 @@ static double mtime(void)
|
|||
{
|
||||
struct timeval tk_time;
|
||||
struct timezone tz;
|
||||
|
||||
|
||||
gettimeofday(&tk_time, &tz);
|
||||
|
||||
|
||||
return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
|
||||
}
|
||||
|
||||
static double filter(double in, double *save)
|
||||
{
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
|
||||
save[3] = in;
|
||||
save[1] = save[0]*k1 + k2*(save[3] + save[2]);
|
||||
save[3] = in;
|
||||
save[1] = save[0]*k1 + k2*(save[3] + save[2]);
|
||||
|
||||
save[0]=save[1];
|
||||
save[2]=save[3];
|
||||
save[0]=save[1];
|
||||
save[2]=save[3];
|
||||
|
||||
return(save[1]);
|
||||
return(save[1]);
|
||||
}
|
||||
|
||||
void DrawStr(const char *str)
|
||||
{
|
||||
GLint i = 0;
|
||||
|
||||
if(!str) return;
|
||||
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
GLint i = 0;
|
||||
|
||||
if(!str) return;
|
||||
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -168,9 +168,9 @@ Atlantis_Init(void)
|
|||
InitFishs();
|
||||
|
||||
glEnable(GL_FOG);
|
||||
glFogi(GL_FOG_MODE, GL_EXP);
|
||||
glFogf(GL_FOG_DENSITY, 0.0000025);
|
||||
glFogfv(GL_FOG_COLOR, fog_color);
|
||||
glFogi(GL_FOG_MODE, GL_EXP);
|
||||
glFogf(GL_FOG_DENSITY, 0.0000025);
|
||||
glFogfv(GL_FOG_COLOR, fog_color);
|
||||
|
||||
glClearColor(0.0, 0.5, 0.9, 1.0);
|
||||
}
|
||||
|
@ -178,9 +178,9 @@ Atlantis_Init(void)
|
|||
void
|
||||
Atlantis_Reshape(int width, int height)
|
||||
{
|
||||
w_win = width;
|
||||
h_win = height;
|
||||
|
||||
w_win = width;
|
||||
h_win = height;
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -212,37 +212,37 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
{
|
||||
switch (key) {
|
||||
case 't':
|
||||
Timing = !Timing;
|
||||
Timing = !Timing;
|
||||
break;
|
||||
case ' ':
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case GL_VENDOR:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case GL_VERSION:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case GL_VENDOR:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case GL_VERSION:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 27: /* Esc will quit */
|
||||
exit(1);
|
||||
break;
|
||||
case 's': /* "s" start animation */
|
||||
case 's': /* "s" start animation */
|
||||
moving = GL_TRUE;
|
||||
//glutIdleFunc(Animate);
|
||||
break;
|
||||
case 'a': /* "a" stop animation */
|
||||
case 'a': /* "a" stop animation */
|
||||
moving = GL_FALSE;
|
||||
//glutIdleFunc(NULL);
|
||||
break;
|
||||
case '.': /* "." will advance frame */
|
||||
case '.': /* "." will advance frame */
|
||||
if (!moving) {
|
||||
Atlantis_Animate();
|
||||
}
|
||||
|
@ -251,21 +251,21 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
/*
|
||||
void Display(void)
|
||||
{
|
||||
static float P123[3] = {-448.94, -203.14, 9499.60};
|
||||
static float P124[3] = {-442.64, -185.20, 9528.07};
|
||||
static float P125[3] = {-441.07, -148.05, 9528.07};
|
||||
static float P126[3] = {-443.43, -128.84, 9499.60};
|
||||
static float P127[3] = {-456.87, -146.78, 9466.67};
|
||||
static float P128[3] = {-453.68, -183.93, 9466.67};
|
||||
static float P123[3] = {-448.94, -203.14, 9499.60};
|
||||
static float P124[3] = {-442.64, -185.20, 9528.07};
|
||||
static float P125[3] = {-441.07, -148.05, 9528.07};
|
||||
static float P126[3] = {-443.43, -128.84, 9499.60};
|
||||
static float P127[3] = {-456.87, -146.78, 9466.67};
|
||||
static float P128[3] = {-453.68, -183.93, 9466.67};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
FishTransform(&dolph);
|
||||
DrawDolphin(&dolph);
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -274,9 +274,9 @@ Atlantis_Display(void)
|
|||
{
|
||||
int i;
|
||||
static double th[4] = {0.0, 0.0, 0.0, 0.0};
|
||||
static double t1 = 0.0, t2 = 0.0, t;
|
||||
char num_str[128];
|
||||
|
||||
static double t1 = 0.0, t2 = 0.0, t;
|
||||
char num_str[128];
|
||||
|
||||
t1 = t2;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
@ -303,56 +303,56 @@ Atlantis_Display(void)
|
|||
glScalef(0.45, 0.45, 0.3);
|
||||
DrawWhale(&babyWhale);
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
if(Timing)
|
||||
{
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glColor3f(1.0, 0.0, 0.0);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
|
||||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glColor3f(1.0, 0.0, 0.0);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
|
||||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
glutSwapBuffers();
|
||||
|
@ -377,18 +377,18 @@ timingSelect(int value)
|
|||
{
|
||||
switch(value)
|
||||
{
|
||||
case 1:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case 2:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case 3:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case 4:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
case 1:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
case 2:
|
||||
StrMode = GL_RENDERER;
|
||||
break;
|
||||
case 3:
|
||||
StrMode = GL_VERSION;
|
||||
break;
|
||||
case 4:
|
||||
StrMode = GL_EXTENSIONS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,24 +413,24 @@ menuSelect(int value)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
GLboolean fullscreen = GL_FALSE;
|
||||
GLint time_menu;
|
||||
|
||||
srand(0);
|
||||
GLboolean fullscreen = GL_FALSE;
|
||||
GLint time_menu;
|
||||
|
||||
srand(0);
|
||||
|
||||
glutInit(&argc, argv);
|
||||
if (argc > 1 && !strcmp(argv[1], "-w"))
|
||||
fullscreen = GL_FALSE;
|
||||
if (argc > 1 && !strcmp(argv[1], "-w"))
|
||||
fullscreen = GL_FALSE;
|
||||
|
||||
//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitDisplayString("rgba double depth=24");
|
||||
if (fullscreen) {
|
||||
glutGameModeString("1024x768:32");
|
||||
glutEnterGameMode();
|
||||
} else {
|
||||
glutInitWindowSize(320, 240);
|
||||
glutCreateWindow("Atlantis Timing");
|
||||
}
|
||||
//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitDisplayString("rgba double depth=24");
|
||||
if (fullscreen) {
|
||||
glutGameModeString("1024x768:32");
|
||||
glutEnterGameMode();
|
||||
} else {
|
||||
glutInitWindowSize(320, 240);
|
||||
glutCreateWindow("Atlantis Timing");
|
||||
}
|
||||
Init();
|
||||
glutDisplayFunc(Display);
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@ -438,19 +438,19 @@ main(int argc, char **argv)
|
|||
moving = GL_TRUE;
|
||||
glutIdleFunc(Animate);
|
||||
glutVisibilityFunc(Visible);
|
||||
|
||||
|
||||
time_menu = glutCreateMenu(timingSelect);
|
||||
glutAddMenuEntry("GL_VENDOR", 1);
|
||||
glutAddMenuEntry("GL_RENDERER", 2);
|
||||
glutAddMenuEntry("GL_VERSION", 3);
|
||||
glutAddMenuEntry("GL_EXTENSIONS", 4);
|
||||
|
||||
|
||||
glutCreateMenu(menuSelect);
|
||||
glutAddMenuEntry("Start motion", 1);
|
||||
glutAddMenuEntry("Stop motion", 2);
|
||||
glutAddSubMenu("Timing Mode", time_menu);
|
||||
glutAddMenuEntry("Quit", 4);
|
||||
|
||||
|
||||
//glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
glutMainLoop();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Please see the SDL documentation for details on using the SDL API:
|
||||
/Developer/Documentation/SDL/docs.html
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -22,18 +22,18 @@ static SDL_Surface *gScreen;
|
|||
static void initAttributes ()
|
||||
{
|
||||
// Setup attributes we want for the OpenGL context
|
||||
|
||||
|
||||
int value;
|
||||
|
||||
|
||||
// Don't set color bit sizes (SDL_GL_RED_SIZE, etc)
|
||||
// Mac OS X will always use 8-8-8-8 ARGB for 32-bit screens and
|
||||
// 5-5-5 RGB for 16-bit screens
|
||||
|
||||
|
||||
// Request a 16-bit depth buffer (without this, there is no depth buffer)
|
||||
value = 16;
|
||||
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, value);
|
||||
|
||||
|
||||
|
||||
|
||||
// Request double-buffered OpenGL
|
||||
// The fact that windows are double-buffered on Mac OS X has no effect
|
||||
// on OpenGL double buffering.
|
||||
|
@ -46,41 +46,41 @@ static void printAttributes ()
|
|||
// Print out attributes of the context we created
|
||||
int nAttr;
|
||||
int i;
|
||||
|
||||
|
||||
int attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
|
||||
SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE };
|
||||
|
||||
|
||||
char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n", "Green size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Depth bufer size: %d bits\n" };
|
||||
|
||||
nAttr = sizeof(attr) / sizeof(int);
|
||||
|
||||
|
||||
for (i = 0; i < nAttr; i++) {
|
||||
|
||||
|
||||
int value;
|
||||
SDL_GL_GetAttribute (attr[i], &value);
|
||||
printf (desc[i], value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void createSurface (int fullscreen)
|
||||
{
|
||||
Uint32 flags = 0;
|
||||
|
||||
|
||||
flags = SDL_OPENGL;
|
||||
if (fullscreen)
|
||||
flags |= SDL_FULLSCREEN;
|
||||
|
||||
|
||||
// Create window
|
||||
gScreen = SDL_SetVideoMode (640, 480, 0, flags);
|
||||
if (gScreen == NULL) {
|
||||
|
||||
|
||||
fprintf (stderr, "Couldn't set 640x480 OpenGL video mode: %s\n",
|
||||
SDL_GetError());
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
SDL_Quit();
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
static void initGL ()
|
||||
|
@ -100,30 +100,30 @@ static void mainLoop ()
|
|||
SDL_Event event;
|
||||
int done = 0;
|
||||
int fps = 24;
|
||||
int delay = 1000/fps;
|
||||
int delay = 1000/fps;
|
||||
int thenTicks = -1;
|
||||
int nowTicks;
|
||||
|
||||
|
||||
while ( !done ) {
|
||||
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent (&event) ) {
|
||||
switch (event.type) {
|
||||
/* Check for events */
|
||||
while ( SDL_PollEvent (&event) ) {
|
||||
switch (event.type) {
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
/* Any keypress quits the app... */
|
||||
case SDL_QUIT:
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw at 24 hz
|
||||
// This approach is not normally recommended - it is better to
|
||||
// use time-based animation and run as fast as possible
|
||||
|
@ -144,36 +144,36 @@ static void mainLoop ()
|
|||
}
|
||||
|
||||
SDL_Delay (delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Init SDL video subsystem
|
||||
if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
|
||||
|
||||
// Init SDL video subsystem
|
||||
if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
|
||||
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Set GL context attributes
|
||||
initAttributes ();
|
||||
|
||||
|
||||
// Create GL context
|
||||
createSurface (0);
|
||||
|
||||
|
||||
// Get GL context attributes
|
||||
printAttributes ();
|
||||
|
||||
|
||||
// Init GL state
|
||||
initGL ();
|
||||
|
||||
|
||||
// Draw, get events...
|
||||
mainLoop ();
|
||||
|
||||
|
||||
// Cleanup
|
||||
SDL_Quit();
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -21,42 +21,42 @@
|
|||
|
||||
/**
|
||||
* \file SDL.h
|
||||
*
|
||||
*
|
||||
* Main include header for the SDL library
|
||||
*/
|
||||
|
||||
/**
|
||||
* \mainpage Simple DirectMedia Layer (SDL)
|
||||
*
|
||||
*
|
||||
* http://www.libsdl.org/
|
||||
*
|
||||
*
|
||||
* \section intro_sec Introduction
|
||||
*
|
||||
*
|
||||
* This is the Simple DirectMedia Layer, a general API that provides low
|
||||
* level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
|
||||
* and 2D framebuffer across multiple platforms.
|
||||
*
|
||||
*
|
||||
* SDL is written in C, but works with C++ natively, and has bindings to
|
||||
* several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
|
||||
* Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
||||
* Pike, Pliant, Python, Ruby, and Smalltalk.
|
||||
*
|
||||
*
|
||||
* This library is distributed under the zlib license, which can be
|
||||
* found in the file "COPYING". This license allows you to use SDL
|
||||
* freely for any purpose as long as you retain the copyright notice.
|
||||
*
|
||||
*
|
||||
* The best way to learn how to use SDL is to check out the header files in
|
||||
* the "include" subdirectory and the programs in the "test" subdirectory.
|
||||
* The header files and test programs are well commented and always up to date.
|
||||
* More documentation and FAQs are available online at:
|
||||
* http://wiki.libsdl.org/
|
||||
*
|
||||
* http://wiki.libsdl.org/
|
||||
*
|
||||
* If you need help with the library, or just want to discuss SDL related
|
||||
* issues, you can join the developers mailing list:
|
||||
* http://www.libsdl.org/mailing-list.php
|
||||
*
|
||||
* http://www.libsdl.org/mailing-list.php
|
||||
*
|
||||
* Enjoy!
|
||||
* Sam Lantinga (slouken@libsdl.org)
|
||||
* Sam Lantinga (slouken@libsdl.org)
|
||||
*/
|
||||
|
||||
#ifndef _SDL_H
|
||||
|
@ -92,16 +92,14 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||
|
||||
/**
|
||||
* \name SDL_INIT_*
|
||||
*
|
||||
*
|
||||
* These are the flags which may be passed to SDL_Init(). You should
|
||||
* specify the subsystems which you will be using in your application.
|
||||
*/
|
||||
|
@ -111,7 +109,7 @@ extern "C" {
|
|||
#define SDL_INIT_VIDEO 0x00000020
|
||||
#define SDL_INIT_JOYSTICK 0x00000200
|
||||
#define SDL_INIT_HAPTIC 0x00001000
|
||||
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */
|
||||
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */
|
||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
|
||||
#define SDL_INIT_EVERYTHING ( \
|
||||
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | \
|
||||
|
@ -139,7 +137,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
|||
/**
|
||||
* This function returns a mask of the specified subsystems which have
|
||||
* previously been initialized.
|
||||
*
|
||||
*
|
||||
* If \c flags is 0, it returns a mask of all initialized subsystems.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
||||
|
@ -152,9 +150,7 @@ extern DECLSPEC void SDLCALL SDL_Quit(void);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#ifndef SDL_ASSERT_LEVEL
|
||||
|
@ -187,7 +185,7 @@ typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
|
|||
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
|
||||
*
|
||||
* \return SDL_assert_state value of how to handle the assertion failure.
|
||||
*
|
||||
*
|
||||
* \param handler Callback function, called when an assertion fails.
|
||||
* \param userdata A pointer passed to the callback as-is.
|
||||
*/
|
||||
|
@ -230,9 +228,7 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,25 +21,25 @@
|
|||
|
||||
/**
|
||||
* \file SDL_atomic.h
|
||||
*
|
||||
*
|
||||
* Atomic operations.
|
||||
*
|
||||
*
|
||||
* IMPORTANT:
|
||||
* If you are not an expert in concurrent lockless programming, you should
|
||||
* only be using the atomic lock and reference counting functions in this
|
||||
* file. In all other cases you should be protecting your data structures
|
||||
* with full mutexes.
|
||||
*
|
||||
*
|
||||
* The list of "safe" functions to use are:
|
||||
* SDL_AtomicLock()
|
||||
* SDL_AtomicUnlock()
|
||||
* SDL_AtomicIncRef()
|
||||
* SDL_AtomicDecRef()
|
||||
*
|
||||
*
|
||||
* Seriously, here be dragons!
|
||||
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
*
|
||||
* You can find out a little more about lockless programming and the
|
||||
* You can find out a little more about lockless programming and the
|
||||
* subtle issues that can arise here:
|
||||
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
|
||||
*
|
||||
|
@ -72,14 +72,12 @@
|
|||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name SDL AtomicLock
|
||||
*
|
||||
*
|
||||
* The atomic locks are efficient spinlocks using CPU instructions,
|
||||
* but are vulnerable to starvation and can spin forever if a thread
|
||||
* holding a lock has been terminated. For this reason you should
|
||||
|
@ -98,7 +96,7 @@ typedef int SDL_SpinLock;
|
|||
|
||||
/**
|
||||
* \brief Try to lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
*
|
||||
* \param lock Points to the lock.
|
||||
*
|
||||
* \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
|
||||
|
@ -107,7 +105,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
|
|||
|
||||
/**
|
||||
* \brief Lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
*
|
||||
* \param lock Points to the lock.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
|
||||
|
@ -304,9 +302,7 @@ SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#include "close_code.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_audio.h
|
||||
*
|
||||
*
|
||||
* Access to the raw audio mixing buffer for the SDL library.
|
||||
*/
|
||||
|
||||
|
@ -38,17 +38,15 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Audio format flags.
|
||||
*
|
||||
*
|
||||
* These are what the 16 bits in SDL_AudioFormat currently mean...
|
||||
* (Unspecified bits are always zero).
|
||||
*
|
||||
*
|
||||
* \verbatim
|
||||
++-----------------------sample is signed if set
|
||||
||
|
||||
|
@ -60,7 +58,7 @@ extern "C" {
|
|||
|| || || | |
|
||||
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
|
||||
\endverbatim
|
||||
*
|
||||
*
|
||||
* There are macros in SDL 2.0 and later to query these bits.
|
||||
*/
|
||||
typedef Uint16 SDL_AudioFormat;
|
||||
|
@ -82,42 +80,38 @@ typedef Uint16 SDL_AudioFormat;
|
|||
#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
|
||||
#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
|
||||
|
||||
/**
|
||||
/**
|
||||
* \name Audio format flags
|
||||
*
|
||||
* Defaults to LSB byte order.
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
|
||||
#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
|
||||
#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
|
||||
#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
|
||||
#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_U16 AUDIO_U16LSB
|
||||
#define AUDIO_S16 AUDIO_S16LSB
|
||||
#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
|
||||
#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
|
||||
#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
|
||||
#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
|
||||
#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_U16 AUDIO_U16LSB
|
||||
#define AUDIO_S16 AUDIO_S16LSB
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name int32 support
|
||||
*
|
||||
* New to SDL 1.3.
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
|
||||
#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_S32 AUDIO_S32LSB
|
||||
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
|
||||
#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_S32 AUDIO_S32LSB
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name float32 support
|
||||
*
|
||||
* New to SDL 1.3.
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
|
||||
#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_F32 AUDIO_F32LSB
|
||||
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
|
||||
#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_F32 AUDIO_F32LSB
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
@ -125,21 +119,21 @@ typedef Uint16 SDL_AudioFormat;
|
|||
*/
|
||||
/*@{*/
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define AUDIO_U16SYS AUDIO_U16LSB
|
||||
#define AUDIO_S16SYS AUDIO_S16LSB
|
||||
#define AUDIO_S32SYS AUDIO_S32LSB
|
||||
#define AUDIO_F32SYS AUDIO_F32LSB
|
||||
#define AUDIO_U16SYS AUDIO_U16LSB
|
||||
#define AUDIO_S16SYS AUDIO_S16LSB
|
||||
#define AUDIO_S32SYS AUDIO_S32LSB
|
||||
#define AUDIO_F32SYS AUDIO_F32LSB
|
||||
#else
|
||||
#define AUDIO_U16SYS AUDIO_U16MSB
|
||||
#define AUDIO_S16SYS AUDIO_S16MSB
|
||||
#define AUDIO_S32SYS AUDIO_S32MSB
|
||||
#define AUDIO_F32SYS AUDIO_F32MSB
|
||||
#define AUDIO_U16SYS AUDIO_U16MSB
|
||||
#define AUDIO_S16SYS AUDIO_S16MSB
|
||||
#define AUDIO_S32SYS AUDIO_S32MSB
|
||||
#define AUDIO_F32SYS AUDIO_F32MSB
|
||||
#endif
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* \name Allow change flags
|
||||
*
|
||||
*
|
||||
* Which audio format changes are allowed when opening a device.
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -209,7 +203,7 @@ typedef struct SDL_AudioCVT
|
|||
|
||||
/**
|
||||
* \name Driver discovery functions
|
||||
*
|
||||
*
|
||||
* These functions return the list of built in audio drivers, in the
|
||||
* order that they are normally initialized by default.
|
||||
*/
|
||||
|
@ -220,9 +214,9 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
|
|||
|
||||
/**
|
||||
* \name Initialization and cleanup
|
||||
*
|
||||
*
|
||||
* \internal These functions are used internally, and should not be used unless
|
||||
* you have a specific need to specify the audio driver you want to
|
||||
* you have a specific need to specify the audio driver you want to
|
||||
* use. You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -242,20 +236,20 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
|
|||
* structure pointed to by \c obtained. If \c obtained is NULL, the audio
|
||||
* data passed to the callback function will be guaranteed to be in the
|
||||
* requested format, and will be automatically converted to the hardware
|
||||
* audio format if necessary. This function returns -1 if it failed
|
||||
* audio format if necessary. This function returns -1 if it failed
|
||||
* to open the audio device, or couldn't set up the audio thread.
|
||||
*
|
||||
*
|
||||
* When filling in the desired audio spec structure,
|
||||
* - \c desired->freq should be the desired audio frequency in samples-per-
|
||||
* second.
|
||||
* - \c desired->format should be the desired audio format.
|
||||
* - \c desired->samples is the desired size of the audio buffer, in
|
||||
* samples. This number should be a power of two, and may be adjusted by
|
||||
* - \c desired->samples is the desired size of the audio buffer, in
|
||||
* samples. This number should be a power of two, and may be adjusted by
|
||||
* the audio driver to a value more suitable for the hardware. Good values
|
||||
* seem to range between 512 and 8096 inclusive, depending on the
|
||||
* application and CPU speed. Smaller values yield faster response time,
|
||||
* but can lead to underflow if the application is doing heavy processing
|
||||
* and cannot fill the audio buffer in time. A stereo sample consists of
|
||||
* seem to range between 512 and 8096 inclusive, depending on the
|
||||
* application and CPU speed. Smaller values yield faster response time,
|
||||
* but can lead to underflow if the application is doing heavy processing
|
||||
* and cannot fill the audio buffer in time. A stereo sample consists of
|
||||
* both right and left channels in LR ordering.
|
||||
* Note that the number of samples is directly related to time by the
|
||||
* following formula: \code ms = (samples*1000)/freq \endcode
|
||||
|
@ -271,7 +265,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
|
|||
* and SDL_UnlockAudio() in your code.
|
||||
* - \c desired->userdata is passed as the first parameter to your callback
|
||||
* function.
|
||||
*
|
||||
*
|
||||
* The audio device starts out playing silence when it's opened, and should
|
||||
* be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
|
||||
* for your audio callback function to be called. Since the audio driver
|
||||
|
@ -283,7 +277,7 @@ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
|
|||
|
||||
/**
|
||||
* SDL Audio Device IDs.
|
||||
*
|
||||
*
|
||||
* A successful call to SDL_OpenAudio() is always device id 1, and legacy
|
||||
* SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
|
||||
* always returns devices >= 2 on success. The legacy calls are good both
|
||||
|
@ -299,7 +293,7 @@ typedef Uint32 SDL_AudioDeviceID;
|
|||
* not an error. For example, if SDL is set up to talk to a remote audio
|
||||
* server, it can't list every one available on the Internet, but it will
|
||||
* still allow a specific host to be specified to SDL_OpenAudioDevice().
|
||||
*
|
||||
*
|
||||
* In many common cases, when this function returns a value <= 0, it can still
|
||||
* successfully open the default device (NULL for first argument of
|
||||
* SDL_OpenAudioDevice()).
|
||||
|
@ -313,7 +307,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
|
|||
* The values returned by this function reflect the latest call to
|
||||
* SDL_GetNumAudioDevices(); recall that function to redetect available
|
||||
* hardware.
|
||||
*
|
||||
*
|
||||
* The string returned by this function is UTF-8 encoded, read-only, and
|
||||
* managed internally. You are not to free it. If you need to keep the
|
||||
* string for any length of time, you should make your own copy of it, as it
|
||||
|
@ -326,14 +320,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
|
|||
/**
|
||||
* Open a specific audio device. Passing in a device name of NULL requests
|
||||
* the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
|
||||
*
|
||||
*
|
||||
* The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
|
||||
* some drivers allow arbitrary and driver-specific strings, such as a
|
||||
* hostname/IP address for a remote audio server, or a filename in the
|
||||
* diskaudio driver.
|
||||
*
|
||||
*
|
||||
* \return 0 on error, a valid device ID that is >= 2 on success.
|
||||
*
|
||||
*
|
||||
* SDL_OpenAudio(), unlike this function, always acts on device ID 1.
|
||||
*/
|
||||
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
|
||||
|
@ -351,7 +345,7 @@ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
|
|||
|
||||
/**
|
||||
* \name Audio state
|
||||
*
|
||||
*
|
||||
* Get the current audio state.
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -369,7 +363,7 @@ SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
|
|||
|
||||
/**
|
||||
* \name Pause audio functions
|
||||
*
|
||||
*
|
||||
* These functions pause and unpause the audio callback processing.
|
||||
* They should be called with a parameter of 0 after opening the audio
|
||||
* device to start playing sound. This is so you can safely initialize
|
||||
|
@ -387,18 +381,18 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
|
|||
* that source if \c freesrc is non-zero. For example, to load a WAVE file,
|
||||
* you could do:
|
||||
* \code
|
||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||
* \endcode
|
||||
*
|
||||
* If this function succeeds, it returns the given SDL_AudioSpec,
|
||||
* filled with the audio data format of the wave data, and sets
|
||||
* \c *audio_buf to a malloc()'d buffer containing the audio data,
|
||||
* and sets \c *audio_len to the length of that audio buffer, in bytes.
|
||||
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
||||
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
||||
* done with it.
|
||||
*
|
||||
* This function returns NULL and sets the SDL error message if the
|
||||
* wave file cannot be opened, uses an unknown data format, or is
|
||||
* This function returns NULL and sets the SDL error message if the
|
||||
* wave file cannot be opened, uses an unknown data format, or is
|
||||
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
||||
*/
|
||||
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
|
||||
|
@ -407,12 +401,12 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
|
|||
Uint8 ** audio_buf,
|
||||
Uint32 * audio_len);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Loads a WAV from a file.
|
||||
* Compatibility convenience function.
|
||||
*/
|
||||
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
||||
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
||||
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
||||
|
||||
/**
|
||||
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
||||
|
@ -424,7 +418,7 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
|
|||
* and rate, and initializes the \c cvt structure with information needed
|
||||
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
||||
* to the other.
|
||||
*
|
||||
*
|
||||
* \return -1 if the format conversion is not supported, 0 if there's
|
||||
* no conversion needed, or 1 if the audio filter is set up.
|
||||
*/
|
||||
|
@ -441,7 +435,7 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
|||
* created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
|
||||
* audio data in the source format, this function will convert it in-place
|
||||
* to the desired format.
|
||||
*
|
||||
*
|
||||
* The data conversion may expand the size of the audio data, so the buffer
|
||||
* \c cvt->buf should be allocated after the \c cvt structure is initialized by
|
||||
* SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
|
||||
|
@ -471,9 +465,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
|
|||
|
||||
/**
|
||||
* \name Audio lock functions
|
||||
*
|
||||
*
|
||||
* The lock manipulated by these functions protects the callback function.
|
||||
* During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
|
||||
* During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
|
||||
* the callback function is not running. Do not call these from the callback
|
||||
* function or you will cause deadlock.
|
||||
*/
|
||||
|
@ -498,9 +492,7 @@ extern DECLSPEC int SDLCALL SDL_AudioDeviceConnected(SDL_AudioDeviceID dev);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -83,9 +81,7 @@ SDL_MostSignificantBitIndex32(Uint32 x)
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_blendmode.h
|
||||
*
|
||||
*
|
||||
* Header file declaring the SDL_BlendMode enumeration
|
||||
*/
|
||||
|
||||
|
@ -31,9 +31,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -49,9 +47,7 @@ typedef enum
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
@ -64,9 +62,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
/**
|
||||
* \file SDL_config.h
|
||||
*/
|
||||
|
||||
|
||||
/* Add any platform that doesn't build using the configure system. */
|
||||
#if defined(__WIN32__)
|
||||
#include "SDL_config_windows.h"
|
||||
#elif defined(__MACOSX__)
|
||||
#include "SDL_config_macosx.h"
|
||||
#elif defined(__IPHONEOS__)
|
||||
#elif defined(__IPHONEOS__)
|
||||
#include "SDL_config_iphoneos.h"
|
||||
#elif defined(__ANDROID__)
|
||||
#include "SDL_config_android.h"
|
||||
|
|
|
@ -26,109 +26,109 @@
|
|||
|
||||
/**
|
||||
* \file SDL_config_android.h
|
||||
*
|
||||
*
|
||||
* This is a configuration that can be used to build SDL for Android
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
|
||||
#define SIZEOF_VOIDP 4
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_ANDROID 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_ANDROID 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_ANDROID 1
|
||||
#define SDL_HAPTIC_DUMMY 1
|
||||
#define SDL_JOYSTICK_ANDROID 1
|
||||
#define SDL_HAPTIC_DUMMY 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_UNIX 1
|
||||
#define SDL_TIMER_UNIX 1
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_ANDROID 1
|
||||
|
||||
/* Enable OpenGL ES */
|
||||
#define SDL_VIDEO_OPENGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
#define SDL_VIDEO_OPENGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_ANDROID 1
|
||||
|
|
|
@ -30,109 +30,109 @@
|
|||
#define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SYSCTLBYNAME 1
|
||||
|
||||
/* enable iPhone version of Core Audio driver */
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
|
||||
/* Enable Unix style SO loading */
|
||||
/* Technically this works, but it violates the iPhone developer agreement */
|
||||
/* #define SDL_LOADSO_DLOPEN 1 */
|
||||
|
||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_UNIX 1
|
||||
#define SDL_TIMER_UNIX 1
|
||||
|
||||
/* Supported video drivers */
|
||||
#define SDL_VIDEO_DRIVER_UIKIT 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_UIKIT 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
/* enable OpenGL ES */
|
||||
#define SDL_VIDEO_OPENGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
#define SDL_VIDEO_OPENGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_UIKIT 1
|
||||
|
|
|
@ -30,106 +30,106 @@
|
|||
/* This is a set of defines to configure the SDL features */
|
||||
|
||||
#ifdef __LP64__
|
||||
#define SIZEOF_VOIDP 8
|
||||
#define SIZEOF_VOIDP 8
|
||||
#else
|
||||
#define SIZEOF_VOIDP 4
|
||||
#define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
/* Useful headers */
|
||||
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
|
||||
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#endif
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SYSCONF 1
|
||||
#define HAVE_SYSCTLBYNAME 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_IOKIT 1
|
||||
#define SDL_HAPTIC_IOKIT 1
|
||||
#define SDL_JOYSTICK_IOKIT 1
|
||||
#define SDL_HAPTIC_IOKIT 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
#define SDL_LOADSO_DLOPEN 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
#define SDL_THREAD_PTHREAD 1
|
||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_UNIX 1
|
||||
#define SDL_TIMER_UNIX 1
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_COCOA 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_COCOA 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#undef SDL_VIDEO_DRIVER_X11
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
|
||||
|
@ -157,27 +157,27 @@
|
|||
#endif
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_OGL
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#endif
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_CGL
|
||||
#define SDL_VIDEO_OPENGL_CGL 1
|
||||
#define SDL_VIDEO_OPENGL_CGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_GLX
|
||||
#define SDL_VIDEO_OPENGL_GLX 1
|
||||
#define SDL_VIDEO_OPENGL_GLX 1
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_MACOSX 1
|
||||
|
||||
/* Enable assembly routines */
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#ifdef __ppc__
|
||||
#define SDL_ALTIVEC_BLITTERS 1
|
||||
#define SDL_ALTIVEC_BLITTERS 1
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_config_macosx_h */
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_config_minimal.h
|
||||
*
|
||||
*
|
||||
* This is the minimal configuration that can be used to build SDL.
|
||||
*/
|
||||
|
||||
|
@ -51,24 +51,24 @@ typedef unsigned long uintptr_t;
|
|||
#endif
|
||||
|
||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
|
||||
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
|
||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
|
||||
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
||||
#define SDL_THREADS_DISABLED 1
|
||||
#define SDL_THREADS_DISABLED 1
|
||||
|
||||
/* Enable the stub timer support (src/timer/dummy/\*.c) */
|
||||
#define SDL_TIMERS_DISABLED 1
|
||||
#define SDL_TIMERS_DISABLED 1
|
||||
|
||||
/* Enable the dummy video driver (src/video/dummy/\*.c) */
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
#endif /* _SDL_config_minimal_h */
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
|
|
|
@ -30,93 +30,93 @@
|
|||
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
|
||||
#endif
|
||||
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
//#define HAVE_SYSCONF 1
|
||||
//#define HAVE_SIGACTION 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
//#define HAVE_SYSCONF 1
|
||||
//#define HAVE_SIGACTION 1
|
||||
|
||||
|
||||
/* PSP isn't that sophisticated */
|
||||
#define LACKS_SYS_MMAN_H 1
|
||||
|
||||
/* Enable the stub thread support (src/thread/psp/\*.c) */
|
||||
#define SDL_THREAD_PSP 1
|
||||
#define SDL_THREAD_PSP 1
|
||||
|
||||
/* Enable the stub timer support (src/timer/psp/\*.c) */
|
||||
#define SDL_TIMERS_PSP 1
|
||||
#define SDL_TIMERS_PSP 1
|
||||
|
||||
/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
|
||||
#define SDL_JOYSTICK_PSP 1
|
||||
#define SDL_JOYSTICK_PSP 1
|
||||
|
||||
/* Enable the stub audio driver (src/audio/psp/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_PSP 1
|
||||
#define SDL_AUDIO_DRIVER_PSP 1
|
||||
|
||||
/* PSP video dirver */
|
||||
#define SDL_VIDEO_DRIVER_PSP 1
|
||||
|
@ -127,10 +127,10 @@
|
|||
#define SDL_POWER_PSP 1
|
||||
|
||||
/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
|
||||
/* PSP can't load shared object (src/loadso/dummy/\*.c) */
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
|
||||
|
||||
#endif /* _SDL_config_psp_h */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#elif defined(_MSC_VER)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
|
@ -136,49 +136,49 @@ typedef unsigned int uintptr_t;
|
|||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#else
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#endif
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||
#ifndef __GNUC__
|
||||
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
||||
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
||||
#endif
|
||||
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_DINPUT 1
|
||||
#define SDL_HAPTIC_DINPUT 1
|
||||
#define SDL_JOYSTICK_DINPUT 1
|
||||
#define SDL_HAPTIC_DINPUT 1
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_WINDOWS 1
|
||||
#define SDL_LOADSO_WINDOWS 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#define SDL_THREAD_WINDOWS 1
|
||||
#define SDL_THREAD_WINDOWS 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_WINDOWS 1
|
||||
#define SDL_TIMER_WINDOWS 1
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_WINDOWS 1
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_WINDOWS 1
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_D3D
|
||||
#define SDL_VIDEO_RENDER_D3D 1
|
||||
#define SDL_VIDEO_RENDER_D3D 1
|
||||
#endif
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_WGL
|
||||
#define SDL_VIDEO_OPENGL_WGL 1
|
||||
#define SDL_VIDEO_OPENGL_WGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_RENDER_OGL
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
|
@ -186,7 +186,7 @@ typedef unsigned int uintptr_t;
|
|||
|
||||
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
||||
#ifndef _WIN64
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_config_windows_h */
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_cpuinfo.h
|
||||
*
|
||||
*
|
||||
* CPU feature detection for SDL.
|
||||
*/
|
||||
|
||||
|
@ -66,9 +66,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* This is a guess for the cacheline size used for padding.
|
||||
|
@ -139,9 +137,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_endian.h
|
||||
*
|
||||
*
|
||||
* Functions for reading and writing endian-specific values
|
||||
*/
|
||||
|
||||
|
@ -34,8 +34,8 @@
|
|||
* \name The two types of endianness
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_LIL_ENDIAN 1234
|
||||
#define SDL_BIG_ENDIAN 4321
|
||||
#define SDL_LIL_ENDIAN 1234
|
||||
#define SDL_BIG_ENDIAN 4321
|
||||
/*@}*/
|
||||
|
||||
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
|
||||
|
@ -48,9 +48,9 @@
|
|||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||
defined(__sparc__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#endif
|
||||
#endif /* __linux __ */
|
||||
#endif /* !SDL_BYTEORDER */
|
||||
|
@ -59,9 +59,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -210,31 +208,29 @@ SDL_SwapFloat(float x)
|
|||
*/
|
||||
/*@{*/
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define SDL_SwapLE16(X) (X)
|
||||
#define SDL_SwapLE32(X) (X)
|
||||
#define SDL_SwapLE64(X) (X)
|
||||
#define SDL_SwapFloatLE(X) (X)
|
||||
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
|
||||
#define SDL_SwapLE16(X) (X)
|
||||
#define SDL_SwapLE32(X) (X)
|
||||
#define SDL_SwapLE64(X) (X)
|
||||
#define SDL_SwapFloatLE(X) (X)
|
||||
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
|
||||
#else
|
||||
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
|
||||
#define SDL_SwapBE16(X) (X)
|
||||
#define SDL_SwapBE32(X) (X)
|
||||
#define SDL_SwapBE64(X) (X)
|
||||
#define SDL_SwapFloatBE(X) (X)
|
||||
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
|
||||
#define SDL_SwapBE16(X) (X)
|
||||
#define SDL_SwapBE32(X) (X)
|
||||
#define SDL_SwapBE64(X) (X)
|
||||
#define SDL_SwapFloatBE(X) (X)
|
||||
#endif
|
||||
/*@}*//*Swap to native*/
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_error.h
|
||||
*
|
||||
*
|
||||
* Simple error message routines for SDL.
|
||||
*/
|
||||
|
||||
|
@ -33,9 +33,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
|
@ -46,14 +44,14 @@ extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
|||
|
||||
/**
|
||||
* \name Internal error functions
|
||||
*
|
||||
* \internal
|
||||
*
|
||||
* \internal
|
||||
* Private error reporting function - used internally.
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
||||
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
||||
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
|
||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
||||
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
||||
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
|
||||
typedef enum
|
||||
{
|
||||
SDL_ENOMEM,
|
||||
|
@ -69,9 +67,7 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_events.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL event handling.
|
||||
*/
|
||||
|
||||
|
@ -42,14 +42,12 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* General keyboard/mouse state definitions */
|
||||
#define SDL_RELEASED 0
|
||||
#define SDL_PRESSED 1
|
||||
#define SDL_RELEASED 0
|
||||
#define SDL_PRESSED 1
|
||||
|
||||
/**
|
||||
* \brief The types of events that can be delivered.
|
||||
|
@ -62,27 +60,27 @@ typedef enum
|
|||
SDL_QUIT = 0x100, /**< User-requested quit */
|
||||
|
||||
/* These application events have special meaning on iOS, see README.iOS for details */
|
||||
SDL_APP_TERMINATING, /**< The application is being terminated by the OS
|
||||
SDL_APP_TERMINATING, /**< The application is being terminated by the OS
|
||||
Called on iOS in applicationWillTerminate()
|
||||
Called on Android in onDestroy()
|
||||
*/
|
||||
SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
|
||||
SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
|
||||
Called on iOS in applicationDidReceiveMemoryWarning()
|
||||
Called on Android in onLowMemory()
|
||||
*/
|
||||
SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
|
||||
SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
|
||||
Called on iOS in applicationWillResignActive()
|
||||
Called on Android in onPause()
|
||||
*/
|
||||
SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
|
||||
SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
|
||||
Called on iOS in applicationDidEnterBackground()
|
||||
Called on Android in onPause()
|
||||
*/
|
||||
SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
|
||||
SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
|
||||
Called on iOS in applicationWillEnterForeground()
|
||||
Called on Android in onResume()
|
||||
*/
|
||||
SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
|
||||
SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
|
||||
Called on iOS in applicationDidBecomeActive()
|
||||
Called on Android in onResume()
|
||||
*/
|
||||
|
@ -112,13 +110,13 @@ typedef enum
|
|||
SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
|
||||
SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
|
||||
|
||||
/* Game controller events */
|
||||
SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
|
||||
SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
|
||||
SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
|
||||
SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
|
||||
SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
|
||||
SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
|
||||
/* Game controller events */
|
||||
SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
|
||||
SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
|
||||
SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
|
||||
SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
|
||||
SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
|
||||
SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
|
||||
|
||||
/* Touch events */
|
||||
SDL_FINGERDOWN = 0x700,
|
||||
|
@ -135,7 +133,7 @@ typedef enum
|
|||
|
||||
/* Drag and drop events */
|
||||
SDL_DROPFILE = 0x1000, /**< The system requests a file open */
|
||||
|
||||
|
||||
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
|
||||
* and should be allocated with SDL_RegisterEvents()
|
||||
*/
|
||||
|
@ -155,7 +153,7 @@ typedef struct SDL_CommonEvent
|
|||
Uint32 type;
|
||||
Uint32 timestamp;
|
||||
} SDL_CommonEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Window state change event data (event.window.*)
|
||||
*/
|
||||
|
@ -285,7 +283,7 @@ typedef struct SDL_JoyAxisEvent
|
|||
typedef struct SDL_JoyBallEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_JOYBALLMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint32 timestamp;
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 ball; /**< The joystick trackball index */
|
||||
Uint8 padding1;
|
||||
|
@ -301,14 +299,14 @@ typedef struct SDL_JoyBallEvent
|
|||
typedef struct SDL_JoyHatEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_JOYHATMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint32 timestamp;
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 hat; /**< The joystick hat index */
|
||||
Uint8 value; /**< The hat position value.
|
||||
* \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
|
||||
* \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
|
||||
* \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
|
||||
*
|
||||
*
|
||||
* Note that zero means the POV is centered.
|
||||
*/
|
||||
Uint8 padding1;
|
||||
|
@ -321,7 +319,7 @@ typedef struct SDL_JoyHatEvent
|
|||
typedef struct SDL_JoyButtonEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
|
||||
Uint32 timestamp;
|
||||
Uint32 timestamp;
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 button; /**< The joystick button index */
|
||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||
|
@ -334,9 +332,9 @@ typedef struct SDL_JoyButtonEvent
|
|||
*/
|
||||
typedef struct SDL_JoyDeviceEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
|
||||
Uint32 timestamp;
|
||||
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
|
||||
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
|
||||
Uint32 timestamp;
|
||||
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
|
||||
} SDL_JoyDeviceEvent;
|
||||
|
||||
|
||||
|
@ -346,7 +344,7 @@ typedef struct SDL_JoyDeviceEvent
|
|||
typedef struct SDL_ControllerAxisEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint32 timestamp;
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
|
||||
Uint8 padding1;
|
||||
|
@ -363,7 +361,7 @@ typedef struct SDL_ControllerAxisEvent
|
|||
typedef struct SDL_ControllerButtonEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
|
||||
Uint32 timestamp;
|
||||
Uint32 timestamp;
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
|
||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||
|
@ -377,9 +375,9 @@ typedef struct SDL_ControllerButtonEvent
|
|||
*/
|
||||
typedef struct SDL_ControllerDeviceEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
|
||||
Uint32 timestamp;
|
||||
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
|
||||
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
|
||||
Uint32 timestamp;
|
||||
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
|
||||
} SDL_ControllerDeviceEvent;
|
||||
|
||||
|
||||
|
@ -411,7 +409,7 @@ typedef struct SDL_MultiGestureEvent
|
|||
float dTheta;
|
||||
float dDist;
|
||||
float x;
|
||||
float y;
|
||||
float y;
|
||||
Uint16 numFingers;
|
||||
Uint16 padding;
|
||||
} SDL_MultiGestureEvent;
|
||||
|
@ -511,9 +509,9 @@ typedef union SDL_Event
|
|||
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
|
||||
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
|
||||
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
|
||||
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
|
||||
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
|
||||
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
|
||||
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
|
||||
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
|
||||
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
|
||||
SDL_QuitEvent quit; /**< Quit request event data */
|
||||
SDL_UserEvent user; /**< Custom event data */
|
||||
SDL_SysWMEvent syswm; /**< System dependent window event data */
|
||||
|
@ -537,9 +535,9 @@ typedef union SDL_Event
|
|||
|
||||
/**
|
||||
* Pumps the event loop, gathering events from the input devices.
|
||||
*
|
||||
*
|
||||
* This function updates the event queue and internal input device state.
|
||||
*
|
||||
*
|
||||
* This should only be run in the thread that sets the video mode.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
|
||||
|
@ -554,20 +552,20 @@ typedef enum
|
|||
|
||||
/**
|
||||
* Checks the event queue for messages and optionally returns them.
|
||||
*
|
||||
*
|
||||
* If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
|
||||
* the back of the event queue.
|
||||
*
|
||||
*
|
||||
* If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
|
||||
* of the event queue, within the specified minimum and maximum type,
|
||||
* will be returned and will not be removed from the queue.
|
||||
*
|
||||
* If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
|
||||
*
|
||||
* If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
|
||||
* of the event queue, within the specified minimum and maximum type,
|
||||
* will be returned and will be removed from the queue.
|
||||
*
|
||||
*
|
||||
* \return The number of events actually stored, or -1 if there was an error.
|
||||
*
|
||||
*
|
||||
* This function is thread-safe.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
|
||||
|
@ -589,31 +587,31 @@ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
|
|||
|
||||
/**
|
||||
* \brief Polls for currently pending events.
|
||||
*
|
||||
*
|
||||
* \return 1 if there are any pending events, or 0 if there are none available.
|
||||
*
|
||||
* \param event If not NULL, the next event is removed from the queue and
|
||||
*
|
||||
* \param event If not NULL, the next event is removed from the queue and
|
||||
* stored in that area.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
|
||||
|
||||
/**
|
||||
* \brief Waits indefinitely for the next available event.
|
||||
*
|
||||
*
|
||||
* \return 1, or 0 if there was an error while waiting for events.
|
||||
*
|
||||
* \param event If not NULL, the next event is removed from the queue and
|
||||
*
|
||||
* \param event If not NULL, the next event is removed from the queue and
|
||||
* stored in that area.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
|
||||
|
||||
/**
|
||||
* \brief Waits until the specified timeout (in milliseconds) for the next
|
||||
* \brief Waits until the specified timeout (in milliseconds) for the next
|
||||
* available event.
|
||||
*
|
||||
*
|
||||
* \return 1, or 0 if there was an error while waiting for events.
|
||||
*
|
||||
* \param event If not NULL, the next event is removed from the queue and
|
||||
*
|
||||
* \param event If not NULL, the next event is removed from the queue and
|
||||
* stored in that area.
|
||||
* \param timeout The timeout (in milliseconds) to wait for next event.
|
||||
*/
|
||||
|
@ -622,8 +620,8 @@ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
|
|||
|
||||
/**
|
||||
* \brief Add an event to the event queue.
|
||||
*
|
||||
* \return 1 on success, 0 if the event was filtered, or -1 if the event queue
|
||||
*
|
||||
* \return 1 on success, 0 if the event was filtered, or -1 if the event queue
|
||||
* was full or there was some other error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
|
||||
|
@ -633,20 +631,20 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
|
|||
/**
|
||||
* Sets up a filter to process all events before they change internal state and
|
||||
* are posted to the internal event queue.
|
||||
*
|
||||
*
|
||||
* The filter is prototyped as:
|
||||
* \code
|
||||
* int SDL_EventFilter(void *userdata, SDL_Event * event);
|
||||
* \endcode
|
||||
*
|
||||
* If the filter returns 1, then the event will be added to the internal queue.
|
||||
* If it returns 0, then the event will be dropped from the queue, but the
|
||||
* If it returns 0, then the event will be dropped from the queue, but the
|
||||
* internal state will still be updated. This allows selective filtering of
|
||||
* dynamically arriving events.
|
||||
*
|
||||
* \warning Be very careful of what you do in the event filter function, as
|
||||
*
|
||||
* \warning Be very careful of what you do in the event filter function, as
|
||||
* it may run in a different thread!
|
||||
*
|
||||
*
|
||||
* There is one caveat when dealing with the ::SDL_QUITEVENT event type. The
|
||||
* event filter is only called when the window manager desires to close the
|
||||
* application window. If the event filter returns 1, then the window will
|
||||
|
@ -685,18 +683,18 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
|
|||
void *userdata);
|
||||
|
||||
/*@{*/
|
||||
#define SDL_QUERY -1
|
||||
#define SDL_IGNORE 0
|
||||
#define SDL_DISABLE 0
|
||||
#define SDL_ENABLE 1
|
||||
#define SDL_QUERY -1
|
||||
#define SDL_IGNORE 0
|
||||
#define SDL_DISABLE 0
|
||||
#define SDL_ENABLE 1
|
||||
|
||||
/**
|
||||
* This function allows you to set the state of processing certain events.
|
||||
* - If \c state is set to ::SDL_IGNORE, that event will be automatically
|
||||
* - If \c state is set to ::SDL_IGNORE, that event will be automatically
|
||||
* dropped from the event queue and will not event be filtered.
|
||||
* - If \c state is set to ::SDL_ENABLE, that event will be processed
|
||||
* - If \c state is set to ::SDL_ENABLE, that event will be processed
|
||||
* normally.
|
||||
* - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
|
||||
* - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
|
||||
* current processing state of the specified event.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
|
||||
|
@ -714,9 +712,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -35,9 +35,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -55,10 +53,10 @@ typedef struct _SDL_GameController SDL_GameController;
|
|||
|
||||
typedef enum
|
||||
{
|
||||
SDL_CONTROLLER_BINDTYPE_NONE = 0,
|
||||
SDL_CONTROLLER_BINDTYPE_BUTTON,
|
||||
SDL_CONTROLLER_BINDTYPE_AXIS,
|
||||
SDL_CONTROLLER_BINDTYPE_HAT
|
||||
SDL_CONTROLLER_BINDTYPE_NONE = 0,
|
||||
SDL_CONTROLLER_BINDTYPE_BUTTON,
|
||||
SDL_CONTROLLER_BINDTYPE_AXIS,
|
||||
SDL_CONTROLLER_BINDTYPE_HAT
|
||||
} SDL_GameControllerBindType;
|
||||
|
||||
/**
|
||||
|
@ -66,43 +64,43 @@ typedef enum
|
|||
*/
|
||||
typedef struct SDL_GameControllerButtonBind
|
||||
{
|
||||
SDL_GameControllerBindType bindType;
|
||||
union
|
||||
{
|
||||
int button;
|
||||
int axis;
|
||||
struct {
|
||||
SDL_GameControllerBindType bindType;
|
||||
union
|
||||
{
|
||||
int button;
|
||||
int axis;
|
||||
struct {
|
||||
int hat;
|
||||
int hat_mask;
|
||||
} hat;
|
||||
} value;
|
||||
} value;
|
||||
|
||||
} SDL_GameControllerButtonBind;
|
||||
|
||||
|
||||
/**
|
||||
* To count the number of game controllers in the system for the following:
|
||||
* int nJoysticks = SDL_NumJoysticks();
|
||||
* int nGameControllers = 0;
|
||||
* for ( int i = 0; i < nJoysticks; i++ ) {
|
||||
* if ( SDL_IsGameController(i) ) {
|
||||
* nGameControllers++;
|
||||
* }
|
||||
* int nJoysticks = SDL_NumJoysticks();
|
||||
* int nGameControllers = 0;
|
||||
* for ( int i = 0; i < nJoysticks; i++ ) {
|
||||
* if ( SDL_IsGameController(i) ) {
|
||||
* nGameControllers++;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
|
||||
* guid,name,mappings
|
||||
* guid,name,mappings
|
||||
*
|
||||
* Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
|
||||
* Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
|
||||
* The mapping format for joystick is:
|
||||
* bX - a joystick button, index X
|
||||
* hX.Y - hat X with value Y
|
||||
* aX - axis X of the joystick
|
||||
* The mapping format for joystick is:
|
||||
* bX - a joystick button, index X
|
||||
* hX.Y - hat X with value Y
|
||||
* aX - axis X of the joystick
|
||||
* Buttons can be used as a controller axis and vice versa.
|
||||
*
|
||||
* This string shows an example of a valid mapping for a controller
|
||||
* "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
|
||||
* "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -179,7 +177,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
|
|||
|
||||
/**
|
||||
* Update the current state of the open game controllers.
|
||||
*
|
||||
*
|
||||
* This is called automatically by the event loop if any game controller
|
||||
* events are enabled.
|
||||
*/
|
||||
|
@ -191,14 +189,14 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_CONTROLLER_AXIS_INVALID = -1,
|
||||
SDL_CONTROLLER_AXIS_LEFTX,
|
||||
SDL_CONTROLLER_AXIS_LEFTY,
|
||||
SDL_CONTROLLER_AXIS_RIGHTX,
|
||||
SDL_CONTROLLER_AXIS_RIGHTY,
|
||||
SDL_CONTROLLER_AXIS_TRIGGERLEFT,
|
||||
SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
|
||||
SDL_CONTROLLER_AXIS_MAX
|
||||
SDL_CONTROLLER_AXIS_INVALID = -1,
|
||||
SDL_CONTROLLER_AXIS_LEFTX,
|
||||
SDL_CONTROLLER_AXIS_LEFTY,
|
||||
SDL_CONTROLLER_AXIS_RIGHTX,
|
||||
SDL_CONTROLLER_AXIS_RIGHTY,
|
||||
SDL_CONTROLLER_AXIS_TRIGGERLEFT,
|
||||
SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
|
||||
SDL_CONTROLLER_AXIS_MAX
|
||||
} SDL_GameControllerAxis;
|
||||
|
||||
/**
|
||||
|
@ -234,23 +232,23 @@ SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_INVALID = -1,
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_UP,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_CONTROLLER_BUTTON_MAX
|
||||
SDL_CONTROLLER_BUTTON_INVALID = -1,
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_UP,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_CONTROLLER_BUTTON_MAX
|
||||
} SDL_GameControllerButton;
|
||||
|
||||
/**
|
||||
|
@ -287,9 +285,7 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_gesture.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL gesture event handling.
|
||||
*/
|
||||
|
||||
|
@ -38,9 +38,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
typedef Sint64 SDL_GestureID;
|
||||
|
@ -80,9 +78,7 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
/**
|
||||
* \file SDL_haptic.h
|
||||
*
|
||||
*
|
||||
* \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
|
||||
* devices.
|
||||
*
|
||||
*
|
||||
* The basic usage is as follows:
|
||||
* - Initialize the Subsystem (::SDL_INIT_HAPTIC).
|
||||
* - Open a Haptic Device.
|
||||
|
@ -119,16 +119,14 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* \typedef SDL_Haptic
|
||||
*
|
||||
*
|
||||
* \brief The haptic structure used to identify an SDL haptic.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticOpenFromJoystick
|
||||
* \sa SDL_HapticClose
|
||||
|
@ -139,7 +137,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
|
||||
/**
|
||||
* \name Haptic features
|
||||
*
|
||||
*
|
||||
* Different haptic features a device can have.
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -153,68 +151,68 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
* \brief Constant effect supported.
|
||||
*
|
||||
* Constant haptic effect.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_CONSTANT (1<<0)
|
||||
|
||||
/**
|
||||
* \brief Sine wave effect supported.
|
||||
*
|
||||
*
|
||||
* Periodic haptic effect that simulates sine waves.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SINE (1<<1)
|
||||
|
||||
/**
|
||||
* \brief Square wave effect supported.
|
||||
*
|
||||
*
|
||||
* Periodic haptic effect that simulates square waves.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SQUARE (1<<2)
|
||||
|
||||
/**
|
||||
* \brief Triangle wave effect supported.
|
||||
*
|
||||
*
|
||||
* Periodic haptic effect that simulates triangular waves.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_TRIANGLE (1<<3)
|
||||
|
||||
/**
|
||||
* \brief Sawtoothup wave effect supported.
|
||||
*
|
||||
*
|
||||
* Periodic haptic effect that simulates saw tooth up waves.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SAWTOOTHUP (1<<4)
|
||||
|
||||
/**
|
||||
* \brief Sawtoothdown wave effect supported.
|
||||
*
|
||||
*
|
||||
* Periodic haptic effect that simulates saw tooth down waves.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticPeriodic
|
||||
*/
|
||||
#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
|
||||
|
||||
/**
|
||||
* \brief Ramp effect supported.
|
||||
*
|
||||
*
|
||||
* Ramp haptic effect.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticRamp
|
||||
*/
|
||||
#define SDL_HAPTIC_RAMP (1<<6)
|
||||
|
||||
/**
|
||||
* \brief Spring effect supported - uses axes position.
|
||||
*
|
||||
*
|
||||
* Condition haptic effect that simulates a spring. Effect is based on the
|
||||
* axes position.
|
||||
*
|
||||
|
@ -224,17 +222,17 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
|
||||
/**
|
||||
* \brief Damper effect supported - uses axes velocity.
|
||||
*
|
||||
*
|
||||
* Condition haptic effect that simulates dampening. Effect is based on the
|
||||
* axes velocity.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_DAMPER (1<<8)
|
||||
|
||||
/**
|
||||
* \brief Inertia effect supported - uses axes acceleration.
|
||||
*
|
||||
*
|
||||
* Condition haptic effect that simulates inertia. Effect is based on the axes
|
||||
* acceleration.
|
||||
*
|
||||
|
@ -244,17 +242,17 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
|
||||
/**
|
||||
* \brief Friction effect supported - uses axes movement.
|
||||
*
|
||||
* Condition haptic effect that simulates friction. Effect is based on the
|
||||
*
|
||||
* Condition haptic effect that simulates friction. Effect is based on the
|
||||
* axes movement.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticCondition
|
||||
*/
|
||||
#define SDL_HAPTIC_FRICTION (1<<10)
|
||||
|
||||
/**
|
||||
* \brief Custom effect is supported.
|
||||
*
|
||||
*
|
||||
* User defined custom haptic effect.
|
||||
*/
|
||||
#define SDL_HAPTIC_CUSTOM (1<<11)
|
||||
|
@ -265,34 +263,34 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
|
||||
/**
|
||||
* \brief Device can set global gain.
|
||||
*
|
||||
*
|
||||
* Device supports setting the global gain.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticSetGain
|
||||
*/
|
||||
#define SDL_HAPTIC_GAIN (1<<12)
|
||||
|
||||
/**
|
||||
* \brief Device can set autocenter.
|
||||
*
|
||||
*
|
||||
* Device supports setting autocenter.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticSetAutocenter
|
||||
*/
|
||||
#define SDL_HAPTIC_AUTOCENTER (1<<13)
|
||||
|
||||
/**
|
||||
* \brief Device can be queried for effect status.
|
||||
*
|
||||
*
|
||||
* Device can be queried for effect status.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticGetEffectStatus
|
||||
*/
|
||||
#define SDL_HAPTIC_STATUS (1<<14)
|
||||
|
||||
/**
|
||||
* \brief Device can be paused.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticPause
|
||||
* \sa SDL_HapticUnpause
|
||||
*/
|
||||
|
@ -306,21 +304,21 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
|
||||
/**
|
||||
* \brief Uses polar coordinates for the direction.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticDirection
|
||||
*/
|
||||
#define SDL_HAPTIC_POLAR 0
|
||||
|
||||
/**
|
||||
* \brief Uses cartesian coordinates for the direction.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticDirection
|
||||
*/
|
||||
#define SDL_HAPTIC_CARTESIAN 1
|
||||
|
||||
/**
|
||||
* \brief Uses spherical coordinates for the direction.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticDirection
|
||||
*/
|
||||
#define SDL_HAPTIC_SPHERICAL 2
|
||||
|
@ -343,7 +341,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
|
||||
/**
|
||||
* \brief Structure that represents a haptic direction.
|
||||
*
|
||||
*
|
||||
* Directions can be specified by:
|
||||
* - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
|
||||
* - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
|
||||
|
@ -361,8 +359,8 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
| | |'-----'|
|
||||
|__|~')_____('
|
||||
[ COMPUTER ]
|
||||
|
||||
|
||||
|
||||
|
||||
North (0,-1)
|
||||
^
|
||||
|
|
||||
|
@ -372,22 +370,22 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
|
|
||||
v
|
||||
South (0,1)
|
||||
|
||||
|
||||
|
||||
|
||||
[ USER ]
|
||||
\|||/
|
||||
(o o)
|
||||
---ooO-(_)-Ooo---
|
||||
\endverbatim
|
||||
*
|
||||
* If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
|
||||
*
|
||||
* If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
|
||||
* degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
|
||||
* the first \c dir parameter. The cardinal directions would be:
|
||||
* - North: 0 (0 degrees)
|
||||
* - East: 9000 (90 degrees)
|
||||
* - South: 18000 (180 degrees)
|
||||
* - West: 27000 (270 degrees)
|
||||
*
|
||||
*
|
||||
* If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
|
||||
* (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
|
||||
* the first three \c dir parameters. The cardinal directions would be:
|
||||
|
@ -395,13 +393,13 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
* - East: -1, 0, 0
|
||||
* - South: 0, 1, 0
|
||||
* - West: 1, 0, 0
|
||||
*
|
||||
*
|
||||
* The Z axis represents the height of the effect if supported, otherwise
|
||||
* it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
|
||||
* can use any multiple you want, only the direction matters.
|
||||
*
|
||||
*
|
||||
* If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
|
||||
* The first two \c dir parameters are used. The \c dir parameters are as
|
||||
* The first two \c dir parameters are used. The \c dir parameters are as
|
||||
* follows (all values are in hundredths of degrees):
|
||||
* - Degrees from (1, 0) rotated towards (0, 1).
|
||||
* - Degrees towards (0, 0, 1) (device needs at least 3 axes).
|
||||
|
@ -411,17 +409,17 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||
* from the south means the user will have to pull the stick to counteract):
|
||||
* \code
|
||||
* SDL_HapticDirection direction;
|
||||
*
|
||||
*
|
||||
* // Cartesian directions
|
||||
* direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
|
||||
* direction.dir[0] = 0; // X position
|
||||
* direction.dir[1] = 1; // Y position
|
||||
* // Assuming the device has 2 axes, we don't need to specify third parameter.
|
||||
*
|
||||
*
|
||||
* // Polar directions
|
||||
* direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
|
||||
* direction.dir[0] = 18000; // Polar only uses first parameter
|
||||
*
|
||||
*
|
||||
* // Spherical coordinates
|
||||
* direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
|
||||
* direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
|
||||
|
@ -442,12 +440,12 @@ typedef struct SDL_HapticDirection
|
|||
|
||||
/**
|
||||
* \brief A structure containing a template for a Constant effect.
|
||||
*
|
||||
*
|
||||
* The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
|
||||
*
|
||||
*
|
||||
* A constant effect applies a constant force in the specified direction
|
||||
* to the joystick.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HAPTIC_CONSTANT
|
||||
* \sa SDL_HapticEffect
|
||||
*/
|
||||
|
@ -477,18 +475,18 @@ typedef struct SDL_HapticConstant
|
|||
|
||||
/**
|
||||
* \brief A structure containing a template for a Periodic effect.
|
||||
*
|
||||
*
|
||||
* The struct handles the following effects:
|
||||
* - ::SDL_HAPTIC_SINE
|
||||
* - ::SDL_HAPTIC_SQUARE
|
||||
* - ::SDL_HAPTIC_TRIANGLE
|
||||
* - ::SDL_HAPTIC_SAWTOOTHUP
|
||||
* - ::SDL_HAPTIC_SAWTOOTHDOWN
|
||||
*
|
||||
*
|
||||
* A periodic effect consists in a wave-shaped effect that repeats itself
|
||||
* over time. The type determines the shape of the wave and the parameters
|
||||
* determine the dimensions of the wave.
|
||||
*
|
||||
*
|
||||
* Phase is given by hundredth of a cycle meaning that giving the phase a value
|
||||
* of 9000 will displace it 25% of its period. Here are sample values:
|
||||
* - 0: No phase displacement.
|
||||
|
@ -503,28 +501,28 @@ typedef struct SDL_HapticConstant
|
|||
__ __ __ __
|
||||
/ \ / \ / \ /
|
||||
/ \__/ \__/ \__/
|
||||
|
||||
|
||||
SDL_HAPTIC_SQUARE
|
||||
__ __ __ __ __
|
||||
| | | | | | | | | |
|
||||
| |__| |__| |__| |__| |
|
||||
|
||||
|
||||
SDL_HAPTIC_TRIANGLE
|
||||
/\ /\ /\ /\ /\
|
||||
/ \ / \ / \ / \ /
|
||||
/ \/ \/ \/ \/
|
||||
|
||||
|
||||
SDL_HAPTIC_SAWTOOTHUP
|
||||
/| /| /| /| /| /| /|
|
||||
/ | / | / | / | / | / | / |
|
||||
/ |/ |/ |/ |/ |/ |/ |
|
||||
|
||||
|
||||
SDL_HAPTIC_SAWTOOTHDOWN
|
||||
\ |\ |\ |\ |\ |\ |\ |
|
||||
\ | \ | \ | \ | \ | \ | \ |
|
||||
\| \| \| \| \| \| \|
|
||||
\endverbatim
|
||||
*
|
||||
*
|
||||
* \sa SDL_HAPTIC_SINE
|
||||
* \sa SDL_HAPTIC_SQUARE
|
||||
* \sa SDL_HAPTIC_TRIANGLE
|
||||
|
@ -563,21 +561,21 @@ typedef struct SDL_HapticPeriodic
|
|||
|
||||
/**
|
||||
* \brief A structure containing a template for a Condition effect.
|
||||
*
|
||||
*
|
||||
* The struct handles the following effects:
|
||||
* - ::SDL_HAPTIC_SPRING: Effect based on axes position.
|
||||
* - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
|
||||
* - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
|
||||
* - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
|
||||
*
|
||||
*
|
||||
* Direction is handled by condition internals instead of a direction member.
|
||||
* The condition effect specific members have three parameters. The first
|
||||
* refers to the X axis, the second refers to the Y axis and the third
|
||||
* refers to the Z axis. The right terms refer to the positive side of the
|
||||
* axis and the left terms refer to the negative side of the axis. Please
|
||||
* axis and the left terms refer to the negative side of the axis. Please
|
||||
* refer to the ::SDL_HapticDirection diagram for which side is positive and
|
||||
* which is negative.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticDirection
|
||||
* \sa SDL_HAPTIC_SPRING
|
||||
* \sa SDL_HAPTIC_DAMPER
|
||||
|
@ -611,14 +609,14 @@ typedef struct SDL_HapticCondition
|
|||
|
||||
/**
|
||||
* \brief A structure containing a template for a Ramp effect.
|
||||
*
|
||||
*
|
||||
* This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
|
||||
*
|
||||
*
|
||||
* The ramp effect starts at start strength and ends at end strength.
|
||||
* It augments in linear fashion. If you use attack and fade with a ramp
|
||||
* they effects get added to the ramp effect making the effect become
|
||||
* quadratic instead of linear.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HAPTIC_RAMP
|
||||
* \sa SDL_HapticEffect
|
||||
*/
|
||||
|
@ -649,14 +647,14 @@ typedef struct SDL_HapticRamp
|
|||
|
||||
/**
|
||||
* \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
|
||||
*
|
||||
*
|
||||
* A custom force feedback effect is much like a periodic effect, where the
|
||||
* application can define its exact shape. You will have to allocate the
|
||||
* data yourself. Data should consist of channels * samples Uint16 samples.
|
||||
*
|
||||
*
|
||||
* If channels is one, the effect is rotated using the defined direction.
|
||||
* Otherwise it uses the samples in data for the different axes.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HAPTIC_CUSTOM
|
||||
* \sa SDL_HapticEffect
|
||||
*/
|
||||
|
@ -689,34 +687,34 @@ typedef struct SDL_HapticCustom
|
|||
|
||||
/**
|
||||
* \brief The generic template for any haptic effect.
|
||||
*
|
||||
*
|
||||
* All values max at 32767 (0x7FFF). Signed values also can be negative.
|
||||
* Time values unless specified otherwise are in milliseconds.
|
||||
*
|
||||
* You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
|
||||
* value. Neither delay, interval, attack_length nor fade_length support
|
||||
*
|
||||
* You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
|
||||
* value. Neither delay, interval, attack_length nor fade_length support
|
||||
* ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
|
||||
*
|
||||
*
|
||||
* Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
|
||||
* ::SDL_HAPTIC_INFINITY.
|
||||
*
|
||||
*
|
||||
* Button triggers may not be supported on all devices, it is advised to not
|
||||
* use them if possible. Buttons start at index 1 instead of index 0 like
|
||||
* they joystick.
|
||||
*
|
||||
*
|
||||
* If both attack_length and fade_level are 0, the envelope is not used,
|
||||
* otherwise both values are used.
|
||||
*
|
||||
*
|
||||
* Common parts:
|
||||
* \code
|
||||
* // Replay - All effects have this
|
||||
* Uint32 length; // Duration of effect (ms).
|
||||
* Uint16 delay; // Delay before starting effect.
|
||||
*
|
||||
*
|
||||
* // Trigger - All effects have this
|
||||
* Uint16 button; // Button that triggers effect.
|
||||
* Uint16 interval; // How soon before effect can be triggered again.
|
||||
*
|
||||
*
|
||||
* // Envelope - All effects except condition effects have this
|
||||
* Uint16 attack_length; // Duration of the attack (ms).
|
||||
* Uint16 attack_level; // Level at the start of the attack.
|
||||
|
@ -734,18 +732,18 @@ typedef struct SDL_HapticCustom
|
|||
| / \
|
||||
| / \
|
||||
| / \
|
||||
| / \
|
||||
| / \
|
||||
| attack_level --> | \
|
||||
| | | <--- fade_level
|
||||
|
|
||||
+--------------------------------------------------> Time
|
||||
[--] [---]
|
||||
attack_length fade_length
|
||||
|
||||
|
||||
[------------------][-----------------------]
|
||||
delay length
|
||||
\endverbatim
|
||||
*
|
||||
*
|
||||
* Note either the attack_level or the fade_level may be above the actual
|
||||
* effect level.
|
||||
*
|
||||
|
@ -770,17 +768,17 @@ typedef union SDL_HapticEffect
|
|||
/* Function prototypes */
|
||||
/**
|
||||
* \brief Count the number of joysticks attached to the system.
|
||||
*
|
||||
*
|
||||
* \return Number of haptic devices detected on the system.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
|
||||
|
||||
/**
|
||||
* \brief Get the implementation dependent name of a Haptic device.
|
||||
*
|
||||
*
|
||||
* This can be called before any joysticks are opened.
|
||||
* If no name can be found, this function returns NULL.
|
||||
*
|
||||
*
|
||||
* \param device_index Index of the device to get its name.
|
||||
* \return Name of the device or NULL on error.
|
||||
*
|
||||
|
@ -790,8 +788,8 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
|
|||
|
||||
/**
|
||||
* \brief Opens a Haptic device for usage.
|
||||
*
|
||||
* The index passed as an argument refers to the N'th Haptic device on this
|
||||
*
|
||||
* The index passed as an argument refers to the N'th Haptic device on this
|
||||
* system.
|
||||
*
|
||||
* When opening a haptic device, its gain will be set to maximum and
|
||||
|
@ -814,10 +812,10 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
|
|||
|
||||
/**
|
||||
* \brief Checks if the haptic device at index has been opened.
|
||||
*
|
||||
*
|
||||
* \param device_index Index to check to see if it has been opened.
|
||||
* \return 1 if it has been opened or 0 if it hasn't.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticIndex
|
||||
*/
|
||||
|
@ -825,10 +823,10 @@ extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
|
|||
|
||||
/**
|
||||
* \brief Gets the index of a haptic device.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to get the index of.
|
||||
* \return The index of the haptic device or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticOpened
|
||||
*/
|
||||
|
@ -836,18 +834,18 @@ extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
|
|||
|
||||
/**
|
||||
* \brief Gets whether or not the current mouse has haptic capabilities.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticOpenFromMouse
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
|
||||
|
||||
/**
|
||||
* \brief Tries to open a haptic device from the current mouse.
|
||||
*
|
||||
*
|
||||
* \return The haptic device identifier or NULL on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_MouseIsHaptic
|
||||
* \sa SDL_HapticOpen
|
||||
*/
|
||||
|
@ -855,29 +853,29 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
|
|||
|
||||
/**
|
||||
* \brief Checks to see if a joystick has haptic features.
|
||||
*
|
||||
*
|
||||
* \param joystick Joystick to test for haptic capabilities.
|
||||
* \return 1 if the joystick is haptic, 0 if it isn't
|
||||
* or -1 if an error ocurred.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticOpenFromJoystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
|
||||
|
||||
/**
|
||||
* \brief Opens a Haptic device for usage from a Joystick device.
|
||||
*
|
||||
* You must still close the haptic device seperately. It will not be closed
|
||||
*
|
||||
* You must still close the haptic device seperately. It will not be closed
|
||||
* with the joystick.
|
||||
*
|
||||
*
|
||||
* When opening from a joystick you should first close the haptic device before
|
||||
* closing the joystick device. If not, on some implementations the haptic
|
||||
* device will also get unallocated and you'll be unable to use force feedback
|
||||
* on that device.
|
||||
*
|
||||
*
|
||||
* \param joystick Joystick to create a haptic device from.
|
||||
* \return A valid haptic device identifier on success or NULL on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticClose
|
||||
*/
|
||||
|
@ -886,34 +884,34 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
|
|||
|
||||
/**
|
||||
* \brief Closes a Haptic device previously opened with SDL_HapticOpen().
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to close.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Returns the number of effects a haptic device can store.
|
||||
*
|
||||
*
|
||||
* On some platforms this isn't fully supported, and therefore is an
|
||||
* approximation. Always check to see if your created effect was actually
|
||||
* created and do not rely solely on SDL_HapticNumEffects().
|
||||
*
|
||||
*
|
||||
* \param haptic The haptic device to query effect max.
|
||||
* \return The number of effects the haptic device can store or
|
||||
* -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticNumEffectsPlaying
|
||||
* \sa SDL_HapticQuery
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Returns the number of effects a haptic device can play at the same
|
||||
* \brief Returns the number of effects a haptic device can play at the same
|
||||
* time.
|
||||
*
|
||||
* This is not supported on all platforms, but will always return a value.
|
||||
*
|
||||
* This is not supported on all platforms, but will always return a value.
|
||||
* Added here for the sake of completeness.
|
||||
*
|
||||
*
|
||||
* \param haptic The haptic device to query maximum playing effects.
|
||||
* \return The number of effects the haptic device can play at the same time
|
||||
* or -1 on error.
|
||||
|
@ -925,17 +923,17 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
|
|||
|
||||
/**
|
||||
* \brief Gets the haptic devices supported features in bitwise matter.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* Example:
|
||||
* \code
|
||||
* if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) {
|
||||
* printf("We have constant haptic effect!");
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* \param haptic The haptic device to query.
|
||||
* \return Haptic features in bitwise manner (OR'd).
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticNumEffects
|
||||
* \sa SDL_HapticEffectSupported
|
||||
*/
|
||||
|
@ -944,18 +942,18 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
|
|||
|
||||
/**
|
||||
* \brief Gets the number of haptic axes the device has.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticDirection
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Checks to see if effect is supported by haptic.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to check on.
|
||||
* \param effect Effect to check to see if it is supported.
|
||||
* \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticQuery
|
||||
* \sa SDL_HapticNewEffect
|
||||
*/
|
||||
|
@ -965,11 +963,11 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Creates a new haptic effect on the device.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to create the effect on.
|
||||
* \param effect Properties of the effect to create.
|
||||
* \return The id of the effect on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticUpdateEffect
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
|
@ -979,17 +977,17 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Updates the properties of an effect.
|
||||
*
|
||||
*
|
||||
* Can be used dynamically, although behaviour when dynamically changing
|
||||
* direction may be strange. Specifically the effect may reupload itself
|
||||
* and start playing from the start. You cannot change the type either when
|
||||
* running SDL_HapticUpdateEffect().
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device that has the effect.
|
||||
* \param effect Effect to update.
|
||||
* \param data New effect properties to use.
|
||||
* \return The id of the effect on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticNewEffect
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
|
@ -1000,18 +998,18 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Runs the haptic effect on its associated haptic device.
|
||||
*
|
||||
*
|
||||
* If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
|
||||
* repeating the envelope (attack and fade) every time. If you only want the
|
||||
* effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
|
||||
* parameter.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to run the effect on.
|
||||
* \param effect Identifier of the haptic effect to run.
|
||||
* \param iterations Number of iterations to run the effect. Use
|
||||
* ::SDL_HAPTIC_INFINITY for infinity.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticStopEffect
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
* \sa SDL_HapticGetEffectStatus
|
||||
|
@ -1022,11 +1020,11 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Stops the haptic effect on its associated haptic device.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to stop the effect on.
|
||||
* \param effect Identifier of the effect to stop.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_HapticDestroyEffect
|
||||
*/
|
||||
|
@ -1035,13 +1033,13 @@ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Destroys a haptic effect on the device.
|
||||
*
|
||||
* This will stop the effect if it's running. Effects are automatically
|
||||
*
|
||||
* This will stop the effect if it's running. Effects are automatically
|
||||
* destroyed when the device is closed.
|
||||
*
|
||||
*
|
||||
* \param haptic Device to destroy the effect on.
|
||||
* \param effect Identifier of the effect to destroy.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticNewEffect
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
|
||||
|
@ -1049,14 +1047,14 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Gets the status of the current effect on the haptic device.
|
||||
*
|
||||
*
|
||||
* Device must support the ::SDL_HAPTIC_STATUS feature.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to query the effect status on.
|
||||
* \param effect Identifier of the effect to query its status.
|
||||
* \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing
|
||||
* or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticRunEffect
|
||||
* \sa SDL_HapticStopEffect
|
||||
*/
|
||||
|
@ -1065,26 +1063,26 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Sets the global gain of the device.
|
||||
*
|
||||
*
|
||||
* Device must support the ::SDL_HAPTIC_GAIN feature.
|
||||
*
|
||||
*
|
||||
* The user may specify the maximum gain by setting the environment variable
|
||||
* ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
|
||||
* SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the
|
||||
* maximum.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to set the gain on.
|
||||
* \param gain Value to set the gain to, should be between 0 and 100.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticQuery
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
|
||||
|
||||
/**
|
||||
* \brief Sets the global autocenter of the device.
|
||||
*
|
||||
* Autocenter should be between 0 and 100. Setting it to 0 will disable
|
||||
*
|
||||
* Autocenter should be between 0 and 100. Setting it to 0 will disable
|
||||
* autocentering.
|
||||
*
|
||||
* Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
|
||||
|
@ -1092,7 +1090,7 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
|
|||
* \param haptic Haptic device to set autocentering on.
|
||||
* \param autocenter Value to set autocenter to, 0 disables autocentering.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticQuery
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
|
||||
|
@ -1100,35 +1098,35 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
|
|||
|
||||
/**
|
||||
* \brief Pauses a haptic device.
|
||||
*
|
||||
* Device must support the ::SDL_HAPTIC_PAUSE feature. Call
|
||||
*
|
||||
* Device must support the ::SDL_HAPTIC_PAUSE feature. Call
|
||||
* SDL_HapticUnpause() to resume playback.
|
||||
*
|
||||
*
|
||||
* Do not modify the effects nor add new ones while the device is paused.
|
||||
* That can cause all sorts of weird errors.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to pause.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticUnpause
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Unpauses a haptic device.
|
||||
*
|
||||
*
|
||||
* Call to unpause after SDL_HapticPause().
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to pause.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HapticPause
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Stops all the currently playing effects on a haptic device.
|
||||
*
|
||||
*
|
||||
* \param haptic Haptic device to stop.
|
||||
* \return 0 on success or -1 on error.
|
||||
*/
|
||||
|
@ -1189,9 +1187,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_hints.h
|
||||
*
|
||||
*
|
||||
* Official documentation for SDL configuration variables
|
||||
*
|
||||
* This file contains functions to set and get configuration hints,
|
||||
|
@ -44,13 +44,11 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface.
|
||||
* \brief A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface.
|
||||
*
|
||||
* SDL can try to accelerate the SDL 1.2 screen surface by using streaming
|
||||
* textures with a 3D rendering engine. This variable controls whether and
|
||||
|
@ -169,7 +167,7 @@ extern "C" {
|
|||
*/
|
||||
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the idle timer is disabled on iOS.
|
||||
*
|
||||
|
@ -183,7 +181,7 @@ extern "C" {
|
|||
* "1" - Disable idle timer
|
||||
*/
|
||||
#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
|
||||
|
||||
|
||||
/**
|
||||
* \brief A variable controlling which orientations are allowed on iOS.
|
||||
*
|
||||
|
@ -208,7 +206,7 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* \brief A variable that lets you manually hint extra gamecontroller db entries
|
||||
*
|
||||
*
|
||||
* The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
|
||||
*
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
|
@ -219,7 +217,7 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it.
|
||||
* This is a debugging aid for developers and not expected to be used by end users. The default is "1"
|
||||
* This is a debugging aid for developers and not expected to be used by end users. The default is "1"
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - don't allow topmost
|
||||
|
@ -246,7 +244,7 @@ typedef enum
|
|||
* The priority controls the behavior when setting a hint that already
|
||||
* has a value. Hints will replace existing hints of their priority and
|
||||
* lower. Environment variables are considered to have override priority.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
|
||||
|
@ -255,7 +253,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
|
|||
|
||||
/**
|
||||
* \brief Set a hint with normal priority
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
|
||||
|
@ -264,7 +262,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
|
|||
|
||||
/**
|
||||
* \brief Get a hint
|
||||
*
|
||||
*
|
||||
* \return The string value of a hint variable.
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
|
||||
|
@ -279,9 +277,7 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_joystick.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL joystick event handling
|
||||
*
|
||||
* The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick
|
||||
|
@ -30,7 +30,7 @@
|
|||
* The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
|
||||
* then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
|
||||
*
|
||||
* The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
|
||||
* The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
|
||||
* the device (a X360 wired controller for example). This identifier is platform dependent.
|
||||
*
|
||||
*
|
||||
|
@ -45,9 +45,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -64,7 +62,7 @@ typedef struct _SDL_Joystick SDL_Joystick;
|
|||
|
||||
/* A structure that encodes the stable unique id for a joystick device */
|
||||
typedef struct {
|
||||
Uint8 data[16];
|
||||
Uint8 data[16];
|
||||
} SDL_JoystickGUID;
|
||||
|
||||
typedef Sint32 SDL_JoystickID;
|
||||
|
@ -84,11 +82,11 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
|||
extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
|
||||
|
||||
/**
|
||||
* Open a joystick for use.
|
||||
* The index passed as an argument refers tothe N'th joystick on the system.
|
||||
* Open a joystick for use.
|
||||
* The index passed as an argument refers tothe N'th joystick on the system.
|
||||
* This index is the value which will identify this joystick in future joystick
|
||||
* events.
|
||||
*
|
||||
*
|
||||
* \return A joystick identifier, or NULL if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
|
||||
|
@ -98,7 +96,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
|
|||
* If no name can be found, this function returns NULL.
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
|
||||
|
||||
|
||||
/**
|
||||
* Return the GUID for the joystick at this index
|
||||
*/
|
||||
|
@ -137,7 +135,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
|
|||
|
||||
/**
|
||||
* Get the number of trackballs on a joystick.
|
||||
*
|
||||
*
|
||||
* Joystick trackballs have only relative motion events associated
|
||||
* with them and their state cannot be polled.
|
||||
*/
|
||||
|
@ -155,7 +153,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
|
|||
|
||||
/**
|
||||
* Update the current state of the open joysticks.
|
||||
*
|
||||
*
|
||||
* This is called automatically by the event loop if any joystick
|
||||
* events are enabled.
|
||||
*/
|
||||
|
@ -163,20 +161,20 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
|||
|
||||
/**
|
||||
* Enable/disable joystick event polling.
|
||||
*
|
||||
*
|
||||
* If joystick events are disabled, you must call SDL_JoystickUpdate()
|
||||
* yourself and check the state of the joystick when you want joystick
|
||||
* information.
|
||||
*
|
||||
*
|
||||
* The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
||||
|
||||
/**
|
||||
* Get the current state of an axis control on a joystick.
|
||||
*
|
||||
*
|
||||
* The state is a value ranging from -32768 to 32767.
|
||||
*
|
||||
*
|
||||
* The axis indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
|
||||
|
@ -186,22 +184,22 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
|
|||
* \name Hat positions
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_HAT_CENTERED 0x00
|
||||
#define SDL_HAT_UP 0x01
|
||||
#define SDL_HAT_RIGHT 0x02
|
||||
#define SDL_HAT_DOWN 0x04
|
||||
#define SDL_HAT_LEFT 0x08
|
||||
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
||||
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
||||
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
||||
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
||||
#define SDL_HAT_CENTERED 0x00
|
||||
#define SDL_HAT_UP 0x01
|
||||
#define SDL_HAT_RIGHT 0x02
|
||||
#define SDL_HAT_DOWN 0x04
|
||||
#define SDL_HAT_LEFT 0x08
|
||||
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
||||
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
||||
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
||||
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Get the current state of a POV hat on a joystick.
|
||||
*
|
||||
* The hat indices start at index 0.
|
||||
*
|
||||
*
|
||||
* \return The return value is one of the following positions:
|
||||
* - ::SDL_HAT_CENTERED
|
||||
* - ::SDL_HAT_UP
|
||||
|
@ -218,9 +216,9 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
|
|||
|
||||
/**
|
||||
* Get the ball axis change since the last poll.
|
||||
*
|
||||
*
|
||||
* \return 0, or -1 if you passed it invalid parameters.
|
||||
*
|
||||
*
|
||||
* The ball indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
|
||||
|
@ -228,7 +226,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
|
|||
|
||||
/**
|
||||
* Get the current state of a button on a joystick.
|
||||
*
|
||||
*
|
||||
* The button indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
|
||||
|
@ -242,9 +240,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_keyboard.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL keyboard event handling
|
||||
*/
|
||||
|
||||
|
@ -36,9 +36,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -61,11 +59,11 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
|||
|
||||
/**
|
||||
* \brief Get a snapshot of the current state of the keyboard.
|
||||
*
|
||||
*
|
||||
* \param numkeys if non-NULL, receives the length of the returned array.
|
||||
*
|
||||
*
|
||||
* \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
|
||||
*
|
||||
*
|
||||
* \b Example:
|
||||
* \code
|
||||
* Uint8 *state = SDL_GetKeyboardState(NULL);
|
||||
|
@ -83,7 +81,7 @@ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
|
|||
|
||||
/**
|
||||
* \brief Set the current key modifier state for the keyboard.
|
||||
*
|
||||
*
|
||||
* \note This does not change the keyboard state, only the key modifier flags.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
||||
|
@ -91,9 +89,9 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
|||
/**
|
||||
* \brief Get the key code corresponding to the given scancode according
|
||||
* to the current keyboard layout.
|
||||
*
|
||||
*
|
||||
* See ::SDL_Keycode for details.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetKeyName()
|
||||
*/
|
||||
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
|
||||
|
@ -101,16 +99,16 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode
|
|||
/**
|
||||
* \brief Get the scancode corresponding to the given key code according to the
|
||||
* current keyboard layout.
|
||||
*
|
||||
*
|
||||
* See ::SDL_Scancode for details.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetScancodeName()
|
||||
*/
|
||||
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
|
||||
|
||||
/**
|
||||
* \brief Get a human-readable name for a scancode.
|
||||
*
|
||||
*
|
||||
* \return A pointer to the name for the scancode.
|
||||
* If the scancode doesn't have a name, this function returns
|
||||
* an empty string ("").
|
||||
|
@ -121,7 +119,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
|
|||
|
||||
/**
|
||||
* \brief Get a scancode from a human-readable name
|
||||
*
|
||||
*
|
||||
* \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
|
||||
*
|
||||
* \sa SDL_Scancode
|
||||
|
@ -130,19 +128,19 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
|
|||
|
||||
/**
|
||||
* \brief Get a human-readable name for a key.
|
||||
*
|
||||
*
|
||||
* \return A pointer to a UTF-8 string that stays valid at least until the next
|
||||
* call to this function. If you need it around any longer, you must
|
||||
* copy it. If the key doesn't have a name, this function returns an
|
||||
* call to this function. If you need it around any longer, you must
|
||||
* copy it. If the key doesn't have a name, this function returns an
|
||||
* empty string ("").
|
||||
*
|
||||
*
|
||||
* \sa SDL_Key
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
|
||||
|
||||
/**
|
||||
* \brief Get a key code from a human-readable name
|
||||
*
|
||||
*
|
||||
* \return key code, or SDLK_UNKNOWN if the name wasn't recognized
|
||||
*
|
||||
* \sa SDL_Keycode
|
||||
|
@ -152,7 +150,7 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
|||
/**
|
||||
* \brief Start accepting Unicode text input events.
|
||||
* This function will show the on-screen keyboard if supported.
|
||||
*
|
||||
*
|
||||
* \sa SDL_StopTextInput()
|
||||
* \sa SDL_SetTextInputRect()
|
||||
* \sa SDL_HasScreenKeyboardSupport()
|
||||
|
@ -170,7 +168,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
|
|||
/**
|
||||
* \brief Stop receiving any text input events.
|
||||
* This function will hide the on-screen keyboard if supported.
|
||||
*
|
||||
*
|
||||
* \sa SDL_StartTextInput()
|
||||
* \sa SDL_HasScreenKeyboardSupport()
|
||||
*/
|
||||
|
@ -179,38 +177,36 @@ extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
|
|||
/**
|
||||
* \brief Set the rectangle used to type Unicode text inputs.
|
||||
* This is used as a hint for IME and on-screen keyboard placement.
|
||||
*
|
||||
*
|
||||
* \sa SDL_StartTextInput()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
|
||||
|
||||
/**
|
||||
* \brief Returns whether the platform has some screen keyboard support.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if some keyboard support is available else SDL_FALSE.
|
||||
*
|
||||
*
|
||||
* \note Not all screen keyboard functions are supported on all platforms.
|
||||
*
|
||||
*
|
||||
* \sa SDL_IsScreenKeyboardShown()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
|
||||
|
||||
/**
|
||||
* \brief Returns whether the screen keyboard is shown for given window.
|
||||
*
|
||||
*
|
||||
* \param window The window for which screen keyboard should be queried.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HasScreenKeyboardSupport()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_keycode.h
|
||||
*
|
||||
*
|
||||
* Defines constants which identify keyboard keys and modifiers.
|
||||
*/
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
/**
|
||||
* \brief The SDL virtual key representation.
|
||||
*
|
||||
*
|
||||
* Values of this type are used to represent keyboard keys using the current
|
||||
* layout of the keyboard. These values include Unicode values representing
|
||||
* the unmodified character that would be generated by pressing the key, or
|
||||
|
@ -42,7 +42,7 @@
|
|||
typedef Sint32 SDL_Keycode;
|
||||
|
||||
#define SDLK_SCANCODE_MASK (1<<30)
|
||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ enum
|
|||
SDLK_GREATER = '>',
|
||||
SDLK_QUESTION = '?',
|
||||
SDLK_AT = '@',
|
||||
/*
|
||||
/*
|
||||
Skip uppercase letters
|
||||
*/
|
||||
SDLK_LEFTBRACKET = '[',
|
||||
|
@ -331,10 +331,10 @@ typedef enum
|
|||
KMOD_RESERVED = 0x8000
|
||||
} SDL_Keymod;
|
||||
|
||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
|
||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
|
||||
|
||||
#endif /* _SDL_keycode_h */
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* System dependent library loading routines
|
||||
*
|
||||
* Some things to keep in mind:
|
||||
* Some things to keep in mind:
|
||||
* \li These functions only work on C function names. Other languages may
|
||||
* have name mangling and intrinsic language support that varies from
|
||||
* compiler to compiler.
|
||||
|
@ -47,9 +47,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -74,9 +72,7 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_log.h
|
||||
*
|
||||
*
|
||||
* Simple log messages with categories and priorities.
|
||||
*
|
||||
* By default logs are quiet, but if you're debugging SDL you might want:
|
||||
|
@ -42,9 +42,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -60,7 +58,7 @@ extern "C" {
|
|||
*
|
||||
* By default the application category is enabled at the INFO level,
|
||||
* the assert category is enabled at the WARN level, test is enabled
|
||||
* at the VERBOSE level and all other categories are enabled at the
|
||||
* at the VERBOSE level and all other categories are enabled at the
|
||||
* CRITICAL level.
|
||||
*/
|
||||
enum
|
||||
|
@ -204,9 +202,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_main.h
|
||||
*
|
||||
*
|
||||
* Redefine main() on some platforms so that it is called by SDL.
|
||||
*/
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
#define C_LINKAGE "C"
|
||||
#else
|
||||
#define C_LINKAGE
|
||||
#endif /* __cplusplus */
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
|
||||
#ifdef SDL_MAIN_NEEDED
|
||||
#define main SDL_main
|
||||
#define main SDL_main
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -69,9 +69,7 @@ extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
|||
|
||||
#include "begin_code.h"
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
@ -87,9 +85,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
|||
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -28,9 +28,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -137,9 +135,7 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_mouse.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL mouse event handling.
|
||||
*/
|
||||
|
||||
|
@ -35,9 +35,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
|
||||
|
@ -71,7 +69,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
|
|||
|
||||
/**
|
||||
* \brief Retrieve the current state of the mouse.
|
||||
*
|
||||
*
|
||||
* The current button state is returned as a button bitmask, which can
|
||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
||||
* mouse cursor position relative to the focus window for the currently
|
||||
|
@ -90,11 +88,11 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
|||
|
||||
/**
|
||||
* \brief Moves the mouse to the given position within the window.
|
||||
*
|
||||
*
|
||||
* \param window The window to move the mouse into, or NULL for the current mouse focus
|
||||
* \param x The x coordinate within the window
|
||||
* \param y The y coordinate within the window
|
||||
*
|
||||
*
|
||||
* \note This function generates a mouse motion event
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
|
||||
|
@ -102,25 +100,25 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Set relative mouse mode.
|
||||
*
|
||||
*
|
||||
* \param enabled Whether or not to enable relative mode
|
||||
*
|
||||
* \return 0 on success, or -1 if relative mode is not supported.
|
||||
*
|
||||
*
|
||||
* While the mouse is in relative mode, the cursor is hidden, and the
|
||||
* driver will try to report continuous motion in the current window.
|
||||
* Only relative motion events will be delivered, the mouse position
|
||||
* will not change.
|
||||
*
|
||||
*
|
||||
* \note This function will flush any pending mouse motion.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetRelativeMouseMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
|
||||
|
||||
/**
|
||||
* \brief Query whether relative mouse mode is enabled.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetRelativeMouseMode()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
|
||||
|
@ -128,19 +126,19 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
|
|||
/**
|
||||
* \brief Create a cursor, using the specified bitmap data and
|
||||
* mask (in MSB format).
|
||||
*
|
||||
*
|
||||
* The cursor width must be a multiple of 8 bits.
|
||||
*
|
||||
*
|
||||
* The cursor is created in black and white according to the following:
|
||||
* <table>
|
||||
* <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
|
||||
* <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
|
||||
* <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
|
||||
* <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
|
||||
* <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
|
||||
* <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
|
||||
* if not. </td></tr>
|
||||
* </table>
|
||||
*
|
||||
*
|
||||
* \sa SDL_FreeCursor()
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
|
||||
|
@ -150,7 +148,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
|
|||
|
||||
/**
|
||||
* \brief Create a color cursor.
|
||||
*
|
||||
*
|
||||
* \sa SDL_FreeCursor()
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
|
||||
|
@ -181,17 +179,17 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
|
|||
|
||||
/**
|
||||
* \brief Frees a cursor created with SDL_CreateCursor().
|
||||
*
|
||||
*
|
||||
* \sa SDL_CreateCursor()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
|
||||
|
||||
/**
|
||||
* \brief Toggle whether or not the cursor is shown.
|
||||
*
|
||||
* \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
|
||||
*
|
||||
* \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
|
||||
* state.
|
||||
*
|
||||
*
|
||||
* \return 1 if the cursor is shown, or 0 if the cursor is hidden.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
||||
|
@ -202,24 +200,22 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
|||
* - Button 2: Middle mouse button
|
||||
* - Button 3: Right mouse button
|
||||
*/
|
||||
#define SDL_BUTTON(X) (1 << ((X)-1))
|
||||
#define SDL_BUTTON_LEFT 1
|
||||
#define SDL_BUTTON_MIDDLE 2
|
||||
#define SDL_BUTTON_RIGHT 3
|
||||
#define SDL_BUTTON_X1 4
|
||||
#define SDL_BUTTON_X2 5
|
||||
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
||||
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
||||
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
||||
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
||||
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
||||
#define SDL_BUTTON(X) (1 << ((X)-1))
|
||||
#define SDL_BUTTON_LEFT 1
|
||||
#define SDL_BUTTON_MIDDLE 2
|
||||
#define SDL_BUTTON_RIGHT 3
|
||||
#define SDL_BUTTON_X1 4
|
||||
#define SDL_BUTTON_X2 5
|
||||
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
||||
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
||||
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
||||
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
||||
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_mutex.h
|
||||
*
|
||||
*
|
||||
* Functions to provide thread synchronization primitives.
|
||||
*/
|
||||
|
||||
|
@ -34,21 +34,19 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Synchronization functions which can time out return this value
|
||||
* if they time out.
|
||||
*/
|
||||
#define SDL_MUTEX_TIMEDOUT 1
|
||||
#define SDL_MUTEX_TIMEDOUT 1
|
||||
|
||||
/**
|
||||
* This is the timeout value which corresponds to never time out.
|
||||
*/
|
||||
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
||||
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -67,31 +65,31 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
|
|||
|
||||
/**
|
||||
* Lock the mutex.
|
||||
*
|
||||
*
|
||||
* \return 0, or -1 on error.
|
||||
*/
|
||||
#define SDL_mutexP(m) SDL_LockMutex(m)
|
||||
#define SDL_mutexP(m) SDL_LockMutex(m)
|
||||
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
* Try to lock the mutex
|
||||
*
|
||||
*
|
||||
* \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
* Unlock the mutex.
|
||||
*
|
||||
*
|
||||
* \return 0, or -1 on error.
|
||||
*
|
||||
*
|
||||
* \warning It is an error to unlock a mutex that has not been locked by
|
||||
* the current thread, and doing so results in undefined behavior.
|
||||
*/
|
||||
#define SDL_mutexV(m) SDL_UnlockMutex(m)
|
||||
#define SDL_mutexV(m) SDL_UnlockMutex(m)
|
||||
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Destroy a mutex.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
|
||||
|
@ -119,34 +117,34 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
|||
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
|
||||
|
||||
/**
|
||||
* This function suspends the calling thread until the semaphore pointed
|
||||
* to by \c sem has a positive count. It then atomically decreases the
|
||||
* This function suspends the calling thread until the semaphore pointed
|
||||
* to by \c sem has a positive count. It then atomically decreases the
|
||||
* semaphore count.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
|
||||
|
||||
/**
|
||||
* Non-blocking variant of SDL_SemWait().
|
||||
*
|
||||
* \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
|
||||
*
|
||||
* \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
|
||||
* block, and -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
|
||||
|
||||
/**
|
||||
* Variant of SDL_SemWait() with a timeout in milliseconds.
|
||||
*
|
||||
* \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
|
||||
*
|
||||
* \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
|
||||
* succeed in the allotted time, and -1 on error.
|
||||
*
|
||||
* \warning On some platforms this function is implemented by looping with a
|
||||
*
|
||||
* \warning On some platforms this function is implemented by looping with a
|
||||
* delay of 1 ms, and so should be avoided if possible.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
|
||||
|
||||
/**
|
||||
* Atomically increases the semaphore's count (not blocking).
|
||||
*
|
||||
*
|
||||
* \return 0, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
|
||||
|
@ -205,7 +203,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
|
|||
|
||||
/**
|
||||
* Restart one of the threads that are waiting on the condition variable.
|
||||
*
|
||||
*
|
||||
* \return 0 or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
|
||||
|
@ -219,11 +217,11 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
|
|||
|
||||
/**
|
||||
* Wait on the condition variable, unlocking the provided mutex.
|
||||
*
|
||||
*
|
||||
* \warning The mutex must be locked before entering this function!
|
||||
*
|
||||
*
|
||||
* The mutex is re-locked once the condition variable is signaled.
|
||||
*
|
||||
*
|
||||
* \return 0 when it is signaled, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
|
||||
|
@ -233,7 +231,7 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
|
|||
* variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
|
||||
* signaled in the allotted time, and -1 on error.
|
||||
*
|
||||
* \warning On some platforms this function is implemented by looping with a
|
||||
* \warning On some platforms this function is implemented by looping with a
|
||||
* delay of 1 ms, and so should be avoided if possible.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
|
||||
|
@ -244,9 +242,7 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
#define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#define SDL_NAME(X) SDL_##X
|
||||
#define SDL_NAME(X) SDL_##X
|
||||
|
||||
#endif /* _SDLname_h_ */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_opengl.h
|
||||
*
|
||||
*
|
||||
* This is a simple file to encapsulate the OpenGL API headers.
|
||||
*/
|
||||
|
||||
|
@ -63,23 +63,22 @@
|
|||
|
||||
/**
|
||||
* \file SDL_opengl.h
|
||||
*
|
||||
*
|
||||
* This file is included because glext.h is not available on some systems.
|
||||
* If you don't want this version included, simply define ::NO_SDL_GLEXT.
|
||||
*
|
||||
*
|
||||
* The latest version is available from:
|
||||
* http://www.opengl.org/registry/
|
||||
* http://www.opengl.org/registry/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def NO_SDL_GLEXT
|
||||
*
|
||||
* Define this if you have your own version of glext.h and want to disable the
|
||||
*
|
||||
* Define this if you have your own version of glext.h and want to disable the
|
||||
* version included in SDL_opengl.h.
|
||||
*/
|
||||
|
||||
#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef __glext_h_
|
||||
#define __glext_h_
|
||||
|
||||
|
@ -89,7 +88,7 @@ extern "C" {
|
|||
|
||||
/*
|
||||
** Copyright (c) 2007-2010 The Khronos Group Inc.
|
||||
**
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
|
@ -97,10 +96,10 @@ extern "C" {
|
|||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
|
@ -11122,7 +11121,6 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons
|
|||
#endif
|
||||
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#endif /* NO_SDL_GLEXT */
|
||||
|
||||
#endif /* !__IPHONEOS__ */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_opengles.h
|
||||
*
|
||||
*
|
||||
* This is a simple file to encapsulate the OpenGL ES 1.X API headers.
|
||||
*/
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_opengles.h
|
||||
*
|
||||
*
|
||||
* This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
|
||||
*/
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_pixels.h
|
||||
*
|
||||
*
|
||||
* Header for the enumerated pixel format definitions.
|
||||
*/
|
||||
|
||||
|
@ -31,14 +31,12 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name Transparency definitions
|
||||
*
|
||||
*
|
||||
* These define alpha as the opacity of a surface.
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -117,11 +115,11 @@ enum
|
|||
((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
|
||||
((bits) << 8) | ((bytes) << 0))
|
||||
|
||||
#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
|
||||
#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
|
||||
#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
|
||||
#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
|
||||
#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
|
||||
#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
|
||||
#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
|
||||
#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
|
||||
#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
|
||||
#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
|
||||
#define SDL_BYTESPERPIXEL(X) \
|
||||
(SDL_ISPIXELFORMAT_FOURCC(X) ? \
|
||||
((((X) == SDL_PIXELFORMAT_YUY2) || \
|
||||
|
@ -301,9 +299,9 @@ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
|
|||
|
||||
/**
|
||||
* \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
|
||||
*
|
||||
*
|
||||
* \sa SDL_MasksToPixelFormatEnum()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
|
||||
|
@ -315,10 +313,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
|
|||
|
||||
/**
|
||||
* \brief Convert a bpp and RGBA masks to an enumerated pixel format.
|
||||
*
|
||||
* \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
|
||||
*
|
||||
* \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
|
||||
* wasn't possible.
|
||||
*
|
||||
*
|
||||
* \sa SDL_PixelFormatEnumToMasks()
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
||||
|
@ -338,13 +336,13 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
|
|||
extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
|
||||
|
||||
/**
|
||||
* \brief Create a palette structure with the specified number of color
|
||||
* \brief Create a palette structure with the specified number of color
|
||||
* entries.
|
||||
*
|
||||
*
|
||||
* \return A new palette, or NULL if there wasn't enough memory.
|
||||
*
|
||||
*
|
||||
* \note The palette entries are initialized to white.
|
||||
*
|
||||
*
|
||||
* \sa SDL_FreePalette()
|
||||
*/
|
||||
extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
|
||||
|
@ -357,12 +355,12 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
|
|||
|
||||
/**
|
||||
* \brief Set a range of colors in a palette.
|
||||
*
|
||||
*
|
||||
* \param palette The palette to modify.
|
||||
* \param colors An array of colors to copy into the palette.
|
||||
* \param firstcolor The index of the first palette entry to modify.
|
||||
* \param ncolors The number of entries to modify.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if not all of the colors could be set.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
|
||||
|
@ -371,14 +369,14 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
|
|||
|
||||
/**
|
||||
* \brief Free a palette created with SDL_AllocPalette().
|
||||
*
|
||||
*
|
||||
* \sa SDL_AllocPalette()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
|
||||
|
||||
/**
|
||||
* \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
|
||||
*
|
||||
*
|
||||
* \sa SDL_MapRGBA
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
|
||||
|
@ -386,7 +384,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
|
|||
|
||||
/**
|
||||
* \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
|
||||
*
|
||||
*
|
||||
* \sa SDL_MapRGB
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
|
||||
|
@ -395,7 +393,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
|
|||
|
||||
/**
|
||||
* \brief Get the RGB components from a pixel of the specified format.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetRGBA
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
||||
|
@ -404,7 +402,7 @@ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
|||
|
||||
/**
|
||||
* \brief Get the RGBA components from a pixel of the specified format.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetRGB
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
|
||||
|
@ -420,9 +418,7 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_platform.h
|
||||
*
|
||||
*
|
||||
* Try to get a standard set of platform defines.
|
||||
*/
|
||||
|
||||
|
@ -30,39 +30,39 @@
|
|||
|
||||
#if defined(_AIX)
|
||||
#undef __AIX__
|
||||
#define __AIX__ 1
|
||||
#define __AIX__ 1
|
||||
#endif
|
||||
#if defined(__BEOS__)
|
||||
#undef __BEOS__
|
||||
#define __BEOS__ 1
|
||||
#define __BEOS__ 1
|
||||
#endif
|
||||
#if defined(__HAIKU__)
|
||||
#undef __HAIKU__
|
||||
#define __HAIKU__ 1
|
||||
#define __HAIKU__ 1
|
||||
#endif
|
||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
||||
#undef __BSDI__
|
||||
#define __BSDI__ 1
|
||||
#define __BSDI__ 1
|
||||
#endif
|
||||
#if defined(_arch_dreamcast)
|
||||
#undef __DREAMCAST__
|
||||
#define __DREAMCAST__ 1
|
||||
#define __DREAMCAST__ 1
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
#undef __FREEBSD__
|
||||
#define __FREEBSD__ 1
|
||||
#define __FREEBSD__ 1
|
||||
#endif
|
||||
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
||||
#undef __HPUX__
|
||||
#define __HPUX__ 1
|
||||
#define __HPUX__ 1
|
||||
#endif
|
||||
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
|
||||
#undef __IRIX__
|
||||
#define __IRIX__ 1
|
||||
#define __IRIX__ 1
|
||||
#endif
|
||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||
#undef __LINUX__
|
||||
#define __LINUX__ 1
|
||||
#define __LINUX__ 1
|
||||
#endif
|
||||
#if defined(ANDROID)
|
||||
#undef __ANDROID__
|
||||
|
@ -82,53 +82,51 @@
|
|||
#else
|
||||
/* if not compiling for iPhone */
|
||||
#undef __MACOSX__
|
||||
#define __MACOSX__ 1
|
||||
#define __MACOSX__ 1
|
||||
#endif /* TARGET_OS_IPHONE */
|
||||
#endif /* defined(__APPLE__) */
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#undef __NETBSD__
|
||||
#define __NETBSD__ 1
|
||||
#define __NETBSD__ 1
|
||||
#endif
|
||||
#if defined(__OpenBSD__)
|
||||
#undef __OPENBSD__
|
||||
#define __OPENBSD__ 1
|
||||
#define __OPENBSD__ 1
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#undef __OS2__
|
||||
#define __OS2__ 1
|
||||
#define __OS2__ 1
|
||||
#endif
|
||||
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
|
||||
#undef __OSF__
|
||||
#define __OSF__ 1
|
||||
#define __OSF__ 1
|
||||
#endif
|
||||
#if defined(__QNXNTO__)
|
||||
#undef __QNXNTO__
|
||||
#define __QNXNTO__ 1
|
||||
#define __QNXNTO__ 1
|
||||
#endif
|
||||
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
|
||||
#undef __RISCOS__
|
||||
#define __RISCOS__ 1
|
||||
#define __RISCOS__ 1
|
||||
#endif
|
||||
#if defined(__SVR4)
|
||||
#undef __SOLARIS__
|
||||
#define __SOLARIS__ 1
|
||||
#define __SOLARIS__ 1
|
||||
#endif
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#undef __WIN32__
|
||||
#define __WIN32__ 1
|
||||
#define __WIN32__ 1
|
||||
#endif
|
||||
#if defined(__PSP__)
|
||||
#undef __PSP__
|
||||
#define __PSP__ 1
|
||||
#define __PSP__ 1
|
||||
#endif
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -138,9 +136,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_power.h
|
||||
*
|
||||
*
|
||||
* Header for the SDL power management routines.
|
||||
*/
|
||||
|
||||
|
@ -33,9 +33,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -53,24 +51,22 @@ typedef enum
|
|||
|
||||
/**
|
||||
* \brief Get the current power supply details.
|
||||
*
|
||||
*
|
||||
* \param secs Seconds of battery life left. You can pass a NULL here if
|
||||
* you don't care. Will return -1 if we can't determine a
|
||||
* value, or we're not running on a battery.
|
||||
*
|
||||
*
|
||||
* \param pct Percentage of battery life left, between 0 and 100. You can
|
||||
* pass a NULL here if you don't care. Will return -1 if we
|
||||
* can't determine a value, or we're not running on a battery.
|
||||
*
|
||||
*
|
||||
* \return The state of the battery (if any).
|
||||
*/
|
||||
extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_quit.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL quit event handling.
|
||||
*/
|
||||
|
||||
|
@ -33,11 +33,11 @@
|
|||
|
||||
/**
|
||||
* \file SDL_quit.h
|
||||
*
|
||||
*
|
||||
* An ::SDL_QUIT event is generated when the user tries to close the application
|
||||
* window. If it is ignored or filtered out, the window will remain open.
|
||||
* If it is not ignored or filtered, it is queued normally and the window
|
||||
* is allowed to close. When the window is closed, screen updates will
|
||||
* is allowed to close. When the window is closed, screen updates will
|
||||
* complete, but have no effect.
|
||||
*
|
||||
* SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
||||
|
@ -46,7 +46,7 @@
|
|||
* to determine the cause of an ::SDL_QUIT event, but setting a signal
|
||||
* handler in your application will override the default generation of
|
||||
* quit events for that signal.
|
||||
*
|
||||
*
|
||||
* \sa SDL_Quit()
|
||||
*/
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_rect.h
|
||||
*
|
||||
*
|
||||
* Header file for SDL_rect definition and management functions.
|
||||
*/
|
||||
|
||||
|
@ -36,9 +36,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -54,7 +52,7 @@ typedef struct
|
|||
|
||||
/**
|
||||
* \brief A rectangle, with the origin at the upper left.
|
||||
*
|
||||
*
|
||||
* \sa SDL_RectEmpty
|
||||
* \sa SDL_RectEquals
|
||||
* \sa SDL_HasIntersection
|
||||
|
@ -87,7 +85,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
|
|||
|
||||
/**
|
||||
* \brief Determine whether two rectangles intersect.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
|
||||
|
@ -95,7 +93,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
|
|||
|
||||
/**
|
||||
* \brief Calculate the intersection of two rectangles.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
|
||||
|
@ -121,7 +119,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
|||
|
||||
/**
|
||||
* \brief Calculate the intersection of a rectangle and line segment.
|
||||
*
|
||||
*
|
||||
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
|
||||
|
@ -131,9 +129,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_render.h
|
||||
*
|
||||
*
|
||||
* Header file for SDL 2D rendering functions.
|
||||
*
|
||||
* This API supports the following features:
|
||||
|
@ -52,9 +52,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -62,10 +60,10 @@ extern "C" {
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
|
||||
SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
|
||||
SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
|
||||
SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
|
||||
acceleration */
|
||||
SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
|
||||
SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
|
||||
with the refresh rate */
|
||||
SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports
|
||||
rendering to texture */
|
||||
|
@ -130,28 +128,28 @@ typedef struct SDL_Texture SDL_Texture;
|
|||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* \brief Get the number of 2D rendering drivers available for the current
|
||||
* \brief Get the number of 2D rendering drivers available for the current
|
||||
* display.
|
||||
*
|
||||
*
|
||||
* A render driver is a set of code that handles rendering and texture
|
||||
* management on a particular display. Normally there is only one, but
|
||||
* some drivers may have several available with different capabilities.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetRenderDriverInfo()
|
||||
* \sa SDL_CreateRenderer()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
|
||||
|
||||
/**
|
||||
* \brief Get information about a specific 2D rendering driver for the current
|
||||
* \brief Get information about a specific 2D rendering driver for the current
|
||||
* display.
|
||||
*
|
||||
*
|
||||
* \param index The index of the driver to query information about.
|
||||
* \param info A pointer to an SDL_RendererInfo struct to be filled with
|
||||
* \param info A pointer to an SDL_RendererInfo struct to be filled with
|
||||
* information on the rendering driver.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, -1 if the index was out of range.
|
||||
*
|
||||
*
|
||||
* \sa SDL_CreateRenderer()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
|
||||
|
@ -175,14 +173,14 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
|
|||
|
||||
/**
|
||||
* \brief Create a 2D rendering context for a window.
|
||||
*
|
||||
*
|
||||
* \param window The window where rendering is displayed.
|
||||
* \param index The index of the rendering driver to initialize, or -1 to
|
||||
* \param index The index of the rendering driver to initialize, or -1 to
|
||||
* initialize the first one supporting the requested flags.
|
||||
* \param flags ::SDL_RendererFlags.
|
||||
*
|
||||
*
|
||||
* \return A valid rendering context or NULL if there was an error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_CreateSoftwareRenderer()
|
||||
* \sa SDL_GetRendererInfo()
|
||||
* \sa SDL_DestroyRenderer()
|
||||
|
@ -192,11 +190,11 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Create a 2D software rendering context for a surface.
|
||||
*
|
||||
*
|
||||
* \param surface The surface where rendering is done.
|
||||
*
|
||||
*
|
||||
* \return A valid rendering context or NULL if there was an error.
|
||||
*
|
||||
*
|
||||
* \sa SDL_CreateRenderer()
|
||||
* \sa SDL_DestroyRenderer()
|
||||
*/
|
||||
|
@ -215,17 +213,17 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Create a texture for a rendering context.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer.
|
||||
* \param format The format of the texture.
|
||||
* \param access One of the enumerated values in ::SDL_TextureAccess.
|
||||
* \param w The width of the texture in pixels.
|
||||
* \param h The height of the texture in pixels.
|
||||
*
|
||||
* \return The created texture is returned, or 0 if no rendering context was
|
||||
*
|
||||
* \return The created texture is returned, or 0 if no rendering context was
|
||||
* active, the format was unsupported, or the width or height were out
|
||||
* of range.
|
||||
*
|
||||
*
|
||||
* \sa SDL_QueryTexture()
|
||||
* \sa SDL_UpdateTexture()
|
||||
* \sa SDL_DestroyTexture()
|
||||
|
@ -237,14 +235,14 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Create a texture from an existing surface.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer.
|
||||
* \param surface The surface containing pixel data used to fill the texture.
|
||||
*
|
||||
*
|
||||
* \return The created texture is returned, or 0 on error.
|
||||
*
|
||||
*
|
||||
* \note The surface is not modified or freed by this function.
|
||||
*
|
||||
*
|
||||
* \sa SDL_QueryTexture()
|
||||
* \sa SDL_DestroyTexture()
|
||||
*/
|
||||
|
@ -252,15 +250,15 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer
|
|||
|
||||
/**
|
||||
* \brief Query the attributes of a texture
|
||||
*
|
||||
*
|
||||
* \param texture A texture to be queried.
|
||||
* \param format A pointer filled in with the raw format of the texture. The
|
||||
* actual format may differ, but pixel transfers will use this
|
||||
* \param format A pointer filled in with the raw format of the texture. The
|
||||
* actual format may differ, but pixel transfers will use this
|
||||
* format.
|
||||
* \param access A pointer filled in with the actual access to the texture.
|
||||
* \param w A pointer filled in with the width of the texture in pixels.
|
||||
* \param h A pointer filled in with the height of the texture in pixels.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
|
||||
|
@ -269,15 +267,15 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Set an additional color value used in render copy operations.
|
||||
*
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param r The red color value multiplied into copy operations.
|
||||
* \param g The green color value multiplied into copy operations.
|
||||
* \param b The blue color value multiplied into copy operations.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or color modulation
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or color modulation
|
||||
* is not supported.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetTextureColorMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
|
||||
|
@ -286,14 +284,14 @@ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Get the additional color value used in render copy operations.
|
||||
*
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param r A pointer filled in with the current red color value.
|
||||
* \param g A pointer filled in with the current green color value.
|
||||
* \param b A pointer filled in with the current blue color value.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetTextureColorMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
|
||||
|
@ -302,13 +300,13 @@ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Set an additional alpha value used in render copy operations.
|
||||
*
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param alpha The alpha value multiplied into copy operations.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or alpha modulation
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or alpha modulation
|
||||
* is not supported.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetTextureAlphaMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
|
||||
|
@ -316,12 +314,12 @@ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Get the additional alpha value used in render copy operations.
|
||||
*
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param alpha A pointer filled in with the current alpha value.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetTextureAlphaMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
|
||||
|
@ -329,16 +327,16 @@ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Set the blend mode used for texture copy operations.
|
||||
*
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param blendMode ::SDL_BlendMode to use for texture blending.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or the blend mode is
|
||||
* not supported.
|
||||
*
|
||||
*
|
||||
* \note If the blend mode is not supported, the closest supported mode is
|
||||
* chosen.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetTextureBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
||||
|
@ -346,12 +344,12 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Get the blend mode used for texture copy operations.
|
||||
*
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param blendMode A pointer filled in with the current blend mode.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetTextureBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
||||
|
@ -359,15 +357,15 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Update the given texture rectangle with new pixel data.
|
||||
*
|
||||
*
|
||||
* \param texture The texture to update
|
||||
* \param rect A pointer to the rectangle of pixels to update, or NULL to
|
||||
* \param rect A pointer to the rectangle of pixels to update, or NULL to
|
||||
* update the entire texture.
|
||||
* \param pixels The raw pixel data.
|
||||
* \param pitch The number of bytes between rows of pixel data.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
*
|
||||
* \note This is a fairly slow function.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
|
||||
|
@ -376,17 +374,17 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Lock a portion of the texture for write-only pixel access.
|
||||
*
|
||||
* \param texture The texture to lock for access, which was created with
|
||||
*
|
||||
* \param texture The texture to lock for access, which was created with
|
||||
* ::SDL_TEXTUREACCESS_STREAMING.
|
||||
* \param rect A pointer to the rectangle to lock for access. If the rect
|
||||
* \param rect A pointer to the rectangle to lock for access. If the rect
|
||||
* is NULL, the entire texture will be locked.
|
||||
* \param pixels This is filled in with a pointer to the locked pixels,
|
||||
* \param pixels This is filled in with a pointer to the locked pixels,
|
||||
* appropriately offset by the locked area.
|
||||
* \param pitch This is filled in with the pitch of the locked pixels.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
|
||||
*
|
||||
*
|
||||
* \sa SDL_UnlockTexture()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
||||
|
@ -395,7 +393,7 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
|||
|
||||
/**
|
||||
* \brief Unlock a texture, uploading the changes to video memory, if needed.
|
||||
*
|
||||
*
|
||||
* \sa SDL_LockTexture()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
|
||||
|
@ -446,7 +444,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer
|
|||
* If the output display is a window, mouse events in the window will be filtered
|
||||
* and scaled so they seem to arrive within the logical resolution.
|
||||
*
|
||||
* \note If this function results in scaling or subpixel drawing by the
|
||||
* \note If this function results in scaling or subpixel drawing by the
|
||||
* rendering backend, it will be handled using the appropriate
|
||||
* quality hints.
|
||||
*
|
||||
|
@ -496,7 +494,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Set the clip rectangle for the current target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer for which clip rectangle should be set.
|
||||
* \param rect A pointer to the rectangle to set as the clip rectangle, or
|
||||
* NULL to disable clipping.
|
||||
|
@ -510,7 +508,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Get the clip rectangle for the current target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer from which clip rectangle should be queried.
|
||||
* \param rect A pointer filled in with the current clip rectangle, or
|
||||
* an empty rectangle if clipping is disabled.
|
||||
|
@ -531,7 +529,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
|
|||
* before they are used by the renderer. This allows resolution
|
||||
* independent drawing with a single coordinate system.
|
||||
*
|
||||
* \note If this results in scaling or subpixel drawing by the
|
||||
* \note If this results in scaling or subpixel drawing by the
|
||||
* rendering backend, it will be handled using the appropriate
|
||||
* quality hints. For best results use integer scaling factors.
|
||||
*
|
||||
|
@ -555,14 +553,14 @@ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Set the color used for drawing operations (Rect, Line and Clear).
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer for which drawing color should be set.
|
||||
* \param r The red value used to draw on the rendering target.
|
||||
* \param g The green value used to draw on the rendering target.
|
||||
* \param b The blue value used to draw on the rendering target.
|
||||
* \param a The alpha value used to draw on the rendering target, usually
|
||||
* \param a The alpha value used to draw on the rendering target, usually
|
||||
* ::SDL_ALPHA_OPAQUE (255).
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
|
||||
|
@ -571,14 +569,14 @@ extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Get the color used for drawing operations (Rect, Line and Clear).
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer from which drawing color should be queried.
|
||||
* \param r A pointer to the red value used to draw on the rendering target.
|
||||
* \param g A pointer to the green value used to draw on the rendering target.
|
||||
* \param b A pointer to the blue value used to draw on the rendering target.
|
||||
* \param a A pointer to the alpha value used to draw on the rendering target,
|
||||
* \param a A pointer to the alpha value used to draw on the rendering target,
|
||||
* usually ::SDL_ALPHA_OPAQUE (255).
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
|
||||
|
@ -587,15 +585,15 @@ extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Set the blend mode used for drawing operations (Fill and Line).
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer for which blend mode should be set.
|
||||
* \param blendMode ::SDL_BlendMode to use for blending.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*
|
||||
* \note If the blend mode is not supported, the closest supported mode is
|
||||
*
|
||||
* \note If the blend mode is not supported, the closest supported mode is
|
||||
* chosen.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetRenderDrawBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
|
||||
|
@ -603,12 +601,12 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Get the blend mode used for drawing operations.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer from which blend mode should be queried.
|
||||
* \param blendMode A pointer filled in with the current blend mode.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetRenderDrawBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
|
||||
|
@ -625,11 +623,11 @@ extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
|
|||
|
||||
/**
|
||||
* \brief Draw a point on the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should draw a point.
|
||||
* \param x The x coordinate of the point.
|
||||
* \param y The y coordinate of the point.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
|
||||
|
@ -637,11 +635,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Draw multiple points on the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should draw multiple points.
|
||||
* \param points The points to draw
|
||||
* \param count The number of points to draw
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
|
||||
|
@ -650,13 +648,13 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Draw a line on the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should draw a line.
|
||||
* \param x1 The x coordinate of the start point.
|
||||
* \param y1 The y coordinate of the start point.
|
||||
* \param x2 The x coordinate of the end point.
|
||||
* \param y2 The y coordinate of the end point.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
|
||||
|
@ -664,11 +662,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Draw a series of connected lines on the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should draw multiple lines.
|
||||
* \param points The points along the lines
|
||||
* \param count The number of points, drawing count-1 lines
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
|
||||
|
@ -677,10 +675,10 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Draw a rectangle on the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should draw a rectangle.
|
||||
* \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
|
||||
|
@ -688,11 +686,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Draw some number of rectangles on the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should draw multiple rectangles.
|
||||
* \param rects A pointer to an array of destination rectangles.
|
||||
* \param count The number of rectangles.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
|
||||
|
@ -701,11 +699,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Fill a rectangle on the current rendering target with the drawing color.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should fill a rectangle.
|
||||
* \param rect A pointer to the destination rectangle, or NULL for the entire
|
||||
* \param rect A pointer to the destination rectangle, or NULL for the entire
|
||||
* rendering target.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
|
||||
|
@ -713,11 +711,11 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Fill some number of rectangles on the current rendering target with the drawing color.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should fill multiple rectangles.
|
||||
* \param rects A pointer to an array of destination rectangles.
|
||||
* \param count The number of rectangles.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
|
||||
|
@ -726,14 +724,14 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Copy a portion of the texture to the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer which should copy parts of a texture.
|
||||
* \param texture The source texture.
|
||||
* \param srcrect A pointer to the source rectangle, or NULL for the entire
|
||||
* \param srcrect A pointer to the source rectangle, or NULL for the entire
|
||||
* texture.
|
||||
* \param dstrect A pointer to the destination rectangle, or NULL for the
|
||||
* \param dstrect A pointer to the destination rectangle, or NULL for the
|
||||
* entire rendering target.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
|
||||
|
@ -742,7 +740,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
|
|||
const SDL_Rect * dstrect);
|
||||
|
||||
/**
|
||||
* \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
|
||||
* \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
|
||||
*
|
||||
* \param renderer The renderer which should copy parts of a texture.
|
||||
* \param texture The source texture.
|
||||
|
@ -753,7 +751,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
|
|||
* \param angle An angle in degrees that indicates the rotation that will be applied to dstrect
|
||||
* \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2)
|
||||
* \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
|
||||
|
@ -766,17 +764,17 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
|
|||
|
||||
/**
|
||||
* \brief Read pixels from the current rendering target.
|
||||
*
|
||||
*
|
||||
* \param renderer The renderer from which pixels should be read.
|
||||
* \param rect A pointer to the rectangle to read, or NULL for the entire
|
||||
* \param rect A pointer to the rectangle to read, or NULL for the entire
|
||||
* render target.
|
||||
* \param format The desired format of the pixel data, or 0 to use the format
|
||||
* of the rendering target
|
||||
* \param pixels A pointer to be filled in with the pixel data
|
||||
* \param pitch The pitch of the pixels parameter.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if pixel reading is not supported.
|
||||
*
|
||||
*
|
||||
* \warning This is a very slow operation, and should not be used frequently.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
|
||||
|
@ -791,7 +789,7 @@ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
|
|||
|
||||
/**
|
||||
* \brief Destroy the specified texture.
|
||||
*
|
||||
*
|
||||
* \sa SDL_CreateTexture()
|
||||
* \sa SDL_CreateTextureFromSurface()
|
||||
*/
|
||||
|
@ -800,7 +798,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
|
|||
/**
|
||||
* \brief Destroy the rendering context for a window and free associated
|
||||
* textures.
|
||||
*
|
||||
*
|
||||
* \sa SDL_CreateRenderer()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
|
||||
|
@ -830,9 +828,7 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_rwops.h
|
||||
*
|
||||
*
|
||||
* This file provides a general interface for SDL to read and write
|
||||
* data streams. It can easily be extended to files, memory, etc.
|
||||
*/
|
||||
|
@ -35,18 +35,16 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* RWops Types */
|
||||
#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */
|
||||
#define SDL_RWOPS_WINFILE 1 /* Win32 file */
|
||||
#define SDL_RWOPS_STDFILE 2 /* Stdio file */
|
||||
#define SDL_RWOPS_JNIFILE 3 /* Android asset */
|
||||
#define SDL_RWOPS_MEMORY 4 /* Memory stream */
|
||||
#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */
|
||||
#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */
|
||||
#define SDL_RWOPS_WINFILE 1 /* Win32 file */
|
||||
#define SDL_RWOPS_STDFILE 2 /* Stdio file */
|
||||
#define SDL_RWOPS_JNIFILE 3 /* Android asset */
|
||||
#define SDL_RWOPS_MEMORY 4 /* Memory stream */
|
||||
#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */
|
||||
|
||||
/**
|
||||
* This is the read/write operation structure -- very basic.
|
||||
|
@ -61,7 +59,7 @@ typedef struct SDL_RWops
|
|||
/**
|
||||
* Seek to \c offset relative to \c whence, one of stdio's whence values:
|
||||
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
|
||||
*
|
||||
*
|
||||
* \return the final offset in the data stream, or -1 on error.
|
||||
*/
|
||||
Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
|
||||
|
@ -70,7 +68,7 @@ typedef struct SDL_RWops
|
|||
/**
|
||||
* Read up to \c maxnum objects each of size \c size from the data
|
||||
* stream to the area pointed at by \c ptr.
|
||||
*
|
||||
*
|
||||
* \return the number of objects read, or 0 at error or end of file.
|
||||
*/
|
||||
size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
|
||||
|
@ -79,7 +77,7 @@ typedef struct SDL_RWops
|
|||
/**
|
||||
* Write exactly \c num objects each of size \c size from the area
|
||||
* pointed at by \c ptr to data stream.
|
||||
*
|
||||
*
|
||||
* \return the number of objects written, or 0 at error or end of file.
|
||||
*/
|
||||
size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
|
||||
|
@ -87,7 +85,7 @@ typedef struct SDL_RWops
|
|||
|
||||
/**
|
||||
* Close and free an allocated SDL_RWops structure.
|
||||
*
|
||||
*
|
||||
* \return 0 if successful or -1 on write error when flushing data.
|
||||
*/
|
||||
int (SDLCALL * close) (struct SDL_RWops * context);
|
||||
|
@ -147,7 +145,7 @@ typedef struct SDL_RWops
|
|||
|
||||
/**
|
||||
* \name RWFrom functions
|
||||
*
|
||||
*
|
||||
* Functions to create SDL_RWops structures from various data streams.
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -173,28 +171,28 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
|
|||
extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
|
||||
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
|
||||
|
||||
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
|
||||
#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
|
||||
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
|
||||
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
|
||||
#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
|
||||
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
|
||||
|
||||
/**
|
||||
* \name Read/write macros
|
||||
*
|
||||
*
|
||||
* Macros to easily read and write from an SDL_RWops structure.
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_RWsize(ctx) (ctx)->size(ctx)
|
||||
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
||||
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
||||
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
||||
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
|
||||
#define SDL_RWclose(ctx) (ctx)->close(ctx)
|
||||
#define SDL_RWsize(ctx) (ctx)->size(ctx)
|
||||
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
||||
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
||||
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
||||
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
|
||||
#define SDL_RWclose(ctx) (ctx)->close(ctx)
|
||||
/*@}*//*Read/write macros*/
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* \name Read endian functions
|
||||
*
|
||||
*
|
||||
* Read an item of the specified endianness and return in native format.
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -207,9 +205,9 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
|
|||
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
|
||||
/*@}*//*Read endian functions*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* \name Write endian functions
|
||||
*
|
||||
*
|
||||
* Write an item of native format to the specified endianness.
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -225,9 +223,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_scancode.h
|
||||
*
|
||||
*
|
||||
* Defines keyboard scancodes.
|
||||
*/
|
||||
|
||||
|
@ -32,11 +32,11 @@
|
|||
|
||||
/**
|
||||
* \brief The SDL keyboard scancode representation.
|
||||
*
|
||||
*
|
||||
* Values of this type are used to represent keyboard keys, among other places
|
||||
* in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
|
||||
* SDL_Event structure.
|
||||
*
|
||||
*
|
||||
* The values in this enumeration are based on the USB usage page standard:
|
||||
* http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
|
||||
*/
|
||||
|
@ -44,9 +44,9 @@ typedef enum
|
|||
{
|
||||
SDL_SCANCODE_UNKNOWN = 0,
|
||||
|
||||
/**
|
||||
/**
|
||||
* \name Usage page 0x07
|
||||
*
|
||||
*
|
||||
* These values are from usage page 0x07 (USB keyboard page).
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -99,49 +99,49 @@ typedef enum
|
|||
SDL_SCANCODE_EQUALS = 46,
|
||||
SDL_SCANCODE_LEFTBRACKET = 47,
|
||||
SDL_SCANCODE_RIGHTBRACKET = 48,
|
||||
SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
|
||||
* key on ISO keyboards and at the right end
|
||||
* of the QWERTY row on ANSI keyboards.
|
||||
* Produces REVERSE SOLIDUS (backslash) and
|
||||
* VERTICAL LINE in a US layout, REVERSE
|
||||
* SOLIDUS and VERTICAL LINE in a UK Mac
|
||||
* layout, NUMBER SIGN and TILDE in a UK
|
||||
SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
|
||||
* key on ISO keyboards and at the right end
|
||||
* of the QWERTY row on ANSI keyboards.
|
||||
* Produces REVERSE SOLIDUS (backslash) and
|
||||
* VERTICAL LINE in a US layout, REVERSE
|
||||
* SOLIDUS and VERTICAL LINE in a UK Mac
|
||||
* layout, NUMBER SIGN and TILDE in a UK
|
||||
* Windows layout, DOLLAR SIGN and POUND SIGN
|
||||
* in a Swiss German layout, NUMBER SIGN and
|
||||
* APOSTROPHE in a German layout, GRAVE
|
||||
* ACCENT and POUND SIGN in a French Mac
|
||||
* layout, and ASTERISK and MICRO SIGN in a
|
||||
* in a Swiss German layout, NUMBER SIGN and
|
||||
* APOSTROPHE in a German layout, GRAVE
|
||||
* ACCENT and POUND SIGN in a French Mac
|
||||
* layout, and ASTERISK and MICRO SIGN in a
|
||||
* French Windows layout.
|
||||
*/
|
||||
SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
|
||||
* instead of 49 for the same key, but all
|
||||
* OSes I've seen treat the two codes
|
||||
SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
|
||||
* instead of 49 for the same key, but all
|
||||
* OSes I've seen treat the two codes
|
||||
* identically. So, as an implementor, unless
|
||||
* your keyboard generates both of those
|
||||
* your keyboard generates both of those
|
||||
* codes and your OS treats them differently,
|
||||
* you should generate SDL_SCANCODE_BACKSLASH
|
||||
* instead of this code. As a user, you
|
||||
* should not rely on this code because SDL
|
||||
* will never generate it with most (all?)
|
||||
* keyboards.
|
||||
* instead of this code. As a user, you
|
||||
* should not rely on this code because SDL
|
||||
* will never generate it with most (all?)
|
||||
* keyboards.
|
||||
*/
|
||||
SDL_SCANCODE_SEMICOLON = 51,
|
||||
SDL_SCANCODE_APOSTROPHE = 52,
|
||||
SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
|
||||
* and ISO keyboards). Produces GRAVE ACCENT and
|
||||
* TILDE in a US Windows layout and in US and UK
|
||||
* Mac layouts on ANSI keyboards, GRAVE ACCENT
|
||||
* and NOT SIGN in a UK Windows layout, SECTION
|
||||
* SIGN and PLUS-MINUS SIGN in US and UK Mac
|
||||
* layouts on ISO keyboards, SECTION SIGN and
|
||||
* DEGREE SIGN in a Swiss German layout (Mac:
|
||||
* only on ISO keyboards), CIRCUMFLEX ACCENT and
|
||||
* DEGREE SIGN in a German layout (Mac: only on
|
||||
SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
|
||||
* and ISO keyboards). Produces GRAVE ACCENT and
|
||||
* TILDE in a US Windows layout and in US and UK
|
||||
* Mac layouts on ANSI keyboards, GRAVE ACCENT
|
||||
* and NOT SIGN in a UK Windows layout, SECTION
|
||||
* SIGN and PLUS-MINUS SIGN in US and UK Mac
|
||||
* layouts on ISO keyboards, SECTION SIGN and
|
||||
* DEGREE SIGN in a Swiss German layout (Mac:
|
||||
* only on ISO keyboards), CIRCUMFLEX ACCENT and
|
||||
* DEGREE SIGN in a German layout (Mac: only on
|
||||
* ISO keyboards), SUPERSCRIPT TWO and TILDE in a
|
||||
* French Windows layout, COMMERCIAL AT and
|
||||
* NUMBER SIGN in a French Mac layout on ISO
|
||||
* French Windows layout, COMMERCIAL AT and
|
||||
* NUMBER SIGN in a French Mac layout on ISO
|
||||
* keyboards, and LESS-THAN SIGN and GREATER-THAN
|
||||
* SIGN in a Swiss German, German, or French Mac
|
||||
* SIGN in a Swiss German, German, or French Mac
|
||||
* layout on ANSI keyboards.
|
||||
*/
|
||||
SDL_SCANCODE_COMMA = 54,
|
||||
|
@ -178,7 +178,7 @@ typedef enum
|
|||
SDL_SCANCODE_DOWN = 81,
|
||||
SDL_SCANCODE_UP = 82,
|
||||
|
||||
SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
|
||||
SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
|
||||
*/
|
||||
SDL_SCANCODE_KP_DIVIDE = 84,
|
||||
SDL_SCANCODE_KP_MULTIPLY = 85,
|
||||
|
@ -197,19 +197,19 @@ typedef enum
|
|||
SDL_SCANCODE_KP_0 = 98,
|
||||
SDL_SCANCODE_KP_PERIOD = 99,
|
||||
|
||||
SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
|
||||
* keyboards have over ANSI ones,
|
||||
* located between left shift and Y.
|
||||
SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
|
||||
* keyboards have over ANSI ones,
|
||||
* located between left shift and Y.
|
||||
* Produces GRAVE ACCENT and TILDE in a
|
||||
* US or UK Mac layout, REVERSE SOLIDUS
|
||||
* (backslash) and VERTICAL LINE in a
|
||||
* US or UK Windows layout, and
|
||||
* (backslash) and VERTICAL LINE in a
|
||||
* US or UK Windows layout, and
|
||||
* LESS-THAN SIGN and GREATER-THAN SIGN
|
||||
* in a Swiss German, German, or French
|
||||
* layout. */
|
||||
SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
|
||||
SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
|
||||
* not a physical key - but some Mac keyboards
|
||||
SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
|
||||
* not a physical key - but some Mac keyboards
|
||||
* do have a power key. */
|
||||
SDL_SCANCODE_KP_EQUALS = 103,
|
||||
SDL_SCANCODE_F13 = 104,
|
||||
|
@ -245,7 +245,7 @@ typedef enum
|
|||
SDL_SCANCODE_KP_COMMA = 133,
|
||||
SDL_SCANCODE_KP_EQUALSAS400 = 134,
|
||||
|
||||
SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
|
||||
SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
|
||||
footnotes in USB doc */
|
||||
SDL_SCANCODE_INTERNATIONAL2 = 136,
|
||||
SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
|
||||
|
@ -334,16 +334,16 @@ typedef enum
|
|||
SDL_SCANCODE_RALT = 230, /**< alt gr, option */
|
||||
SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
|
||||
|
||||
SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
|
||||
* by any of the above, but since there's a
|
||||
SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
|
||||
* by any of the above, but since there's a
|
||||
* special KMOD_MODE for it I'm adding it here
|
||||
*/
|
||||
|
||||
|
||||
/*@}*//*Usage page 0x07*/
|
||||
|
||||
/**
|
||||
* \name Usage page 0x0C
|
||||
*
|
||||
*
|
||||
* These values are mapped from usage page 0x0C (USB consumer page).
|
||||
*/
|
||||
/*@{*/
|
||||
|
@ -365,34 +365,34 @@ typedef enum
|
|||
SDL_SCANCODE_AC_STOP = 272,
|
||||
SDL_SCANCODE_AC_REFRESH = 273,
|
||||
SDL_SCANCODE_AC_BOOKMARKS = 274,
|
||||
|
||||
|
||||
/*@}*//*Usage page 0x0C*/
|
||||
|
||||
/**
|
||||
* \name Walther keys
|
||||
*
|
||||
*
|
||||
* These are values that Christian Walther added (for mac keyboard?).
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
SDL_SCANCODE_BRIGHTNESSDOWN = 275,
|
||||
SDL_SCANCODE_BRIGHTNESSUP = 276,
|
||||
SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
|
||||
SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
|
||||
switch, video mode switch */
|
||||
SDL_SCANCODE_KBDILLUMTOGGLE = 278,
|
||||
SDL_SCANCODE_KBDILLUMDOWN = 279,
|
||||
SDL_SCANCODE_KBDILLUMUP = 280,
|
||||
SDL_SCANCODE_EJECT = 281,
|
||||
SDL_SCANCODE_SLEEP = 282,
|
||||
|
||||
SDL_SCANCODE_APP1 = 283,
|
||||
SDL_SCANCODE_APP2 = 284,
|
||||
|
||||
SDL_SCANCODE_APP1 = 283,
|
||||
SDL_SCANCODE_APP2 = 284,
|
||||
|
||||
/*@}*//*Walther keys*/
|
||||
|
||||
/* Add any other keys here. */
|
||||
|
||||
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
|
||||
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
|
||||
for array bounds */
|
||||
} SDL_Scancode;
|
||||
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/** \file SDL_shape.h
|
||||
|
@ -47,28 +45,28 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* \brief Create a window that can be shaped with the specified position, dimensions, and flags.
|
||||
*
|
||||
*
|
||||
* \param title The title of the window, in UTF-8 encoding.
|
||||
* \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* ::SDL_WINDOWPOS_UNDEFINED.
|
||||
* \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* ::SDL_WINDOWPOS_UNDEFINED.
|
||||
* \param w The width of the window.
|
||||
* \param h The height of the window.
|
||||
* \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
|
||||
* \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
|
||||
* ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
|
||||
* ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_RESIZABLE,
|
||||
* ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
|
||||
* ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
|
||||
*
|
||||
* ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
|
||||
*
|
||||
* \return The window created, or NULL if window creation failed.
|
||||
*
|
||||
*
|
||||
* \sa SDL_DestroyWindow()
|
||||
*/
|
||||
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
|
||||
|
||||
/**
|
||||
* \brief Return whether the given window is a shaped window.
|
||||
* \brief Return whether the given window is a shaped window.
|
||||
*
|
||||
* \param window The window to query for being shaped.
|
||||
*
|
||||
|
@ -79,31 +77,31 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
|
|||
|
||||
/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
|
||||
typedef enum {
|
||||
/** \brief The default mode, a binarized alpha cutoff of 1. */
|
||||
ShapeModeDefault,
|
||||
/** \brief A binarized alpha cutoff with a given integer value. */
|
||||
ShapeModeBinarizeAlpha,
|
||||
/** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
|
||||
ShapeModeReverseBinarizeAlpha,
|
||||
/** \brief A color key is applied. */
|
||||
ShapeModeColorKey
|
||||
/** \brief The default mode, a binarized alpha cutoff of 1. */
|
||||
ShapeModeDefault,
|
||||
/** \brief A binarized alpha cutoff with a given integer value. */
|
||||
ShapeModeBinarizeAlpha,
|
||||
/** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
|
||||
ShapeModeReverseBinarizeAlpha,
|
||||
/** \brief A color key is applied. */
|
||||
ShapeModeColorKey
|
||||
} WindowShapeMode;
|
||||
|
||||
#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
|
||||
|
||||
/** \brief A union containing parameters for shaped windows. */
|
||||
typedef union {
|
||||
/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
|
||||
Uint8 binarizationCutoff;
|
||||
SDL_Color colorKey;
|
||||
/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
|
||||
Uint8 binarizationCutoff;
|
||||
SDL_Color colorKey;
|
||||
} SDL_WindowShapeParams;
|
||||
|
||||
/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
|
||||
typedef struct SDL_WindowShapeMode {
|
||||
/** \brief The mode of these window-shape parameters. */
|
||||
WindowShapeMode mode;
|
||||
/** \brief Window-shape parameters. */
|
||||
SDL_WindowShapeParams parameters;
|
||||
/** \brief The mode of these window-shape parameters. */
|
||||
WindowShapeMode mode;
|
||||
/** \brief Window-shape parameters. */
|
||||
SDL_WindowShapeParams parameters;
|
||||
} SDL_WindowShapeMode;
|
||||
|
||||
/**
|
||||
|
@ -138,9 +136,7 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_stdinc.h
|
||||
*
|
||||
*
|
||||
* This is a general header that includes C language support.
|
||||
*/
|
||||
|
||||
|
@ -80,12 +80,12 @@
|
|||
/**
|
||||
* The number of elements in an array.
|
||||
*/
|
||||
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
|
||||
#define SDL_TABLESIZE(table) SDL_arraysize(table)
|
||||
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
|
||||
#define SDL_TABLESIZE(table) SDL_arraysize(table)
|
||||
|
||||
/**
|
||||
* \name Cast operators
|
||||
*
|
||||
*
|
||||
* Use proper C++ casts when compiled as C++ to be compatible with the option
|
||||
* -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
|
||||
*/
|
||||
|
@ -179,7 +179,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
|||
|
||||
/** \cond */
|
||||
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
|
||||
#if !defined(__ANDROID__)
|
||||
#if !defined(__ANDROID__)
|
||||
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -194,9 +194,7 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ALLOCA) && !defined(alloca)
|
||||
|
@ -758,10 +756,10 @@ SDL_FORCE_INLINE double SDL_sqrt_inline(double x) { return sqrt(x); }
|
|||
#endif
|
||||
|
||||
/* The SDL implementation of iconv() returns these error codes */
|
||||
#define SDL_ICONV_ERROR (size_t)-1
|
||||
#define SDL_ICONV_E2BIG (size_t)-2
|
||||
#define SDL_ICONV_EILSEQ (size_t)-3
|
||||
#define SDL_ICONV_EINVAL (size_t)-4
|
||||
#define SDL_ICONV_ERROR (size_t)-1
|
||||
#define SDL_ICONV_E2BIG (size_t)-2
|
||||
#define SDL_ICONV_EILSEQ (size_t)-3
|
||||
#define SDL_ICONV_EINVAL (size_t)-4
|
||||
|
||||
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
|
||||
typedef struct _SDL_iconv_t *SDL_iconv_t;
|
||||
|
@ -779,15 +777,13 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
|||
const char *fromcode,
|
||||
const char *inbuf,
|
||||
size_t inbytesleft);
|
||||
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_surface.h
|
||||
*
|
||||
*
|
||||
* Header file for ::SDL_surface definition and management functions.
|
||||
*/
|
||||
|
||||
|
@ -37,16 +37,14 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name Surface flags
|
||||
*
|
||||
*
|
||||
* These are the currently supported flags for the ::SDL_surface.
|
||||
*
|
||||
*
|
||||
* \internal
|
||||
* Used internally (read-only).
|
||||
*/
|
||||
|
@ -60,7 +58,7 @@ extern "C" {
|
|||
/**
|
||||
* Evaluates to true if the surface needs to be locked before access.
|
||||
*/
|
||||
#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
|
||||
#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
|
||||
|
||||
/**
|
||||
* \brief A collection of pixels used in software blitting.
|
||||
|
@ -101,13 +99,13 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
|
|||
|
||||
/**
|
||||
* Allocate and free an RGB surface.
|
||||
*
|
||||
*
|
||||
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
|
||||
* If the depth is greater than 8 bits, the pixel format is set using the
|
||||
* flags '[RGB]mask'.
|
||||
*
|
||||
*
|
||||
* If the function runs out of memory, it will return NULL.
|
||||
*
|
||||
*
|
||||
* \param flags The \c flags are obsolete and should be set to 0.
|
||||
* \param width The width in pixels of the surface to create.
|
||||
* \param height The height in pixels of the surface to create.
|
||||
|
@ -133,9 +131,9 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
|
|||
|
||||
/**
|
||||
* \brief Set the palette used by a surface.
|
||||
*
|
||||
*
|
||||
* \return 0, or -1 if the surface format doesn't use a palette.
|
||||
*
|
||||
*
|
||||
* \note A single palette can be shared with many surfaces.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
|
||||
|
@ -143,21 +141,21 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Sets up a surface for directly accessing the pixels.
|
||||
*
|
||||
*
|
||||
* Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
|
||||
* to and read from \c surface->pixels, using the pixel format stored in
|
||||
* \c surface->format. Once you are done accessing the surface, you should
|
||||
* to and read from \c surface->pixels, using the pixel format stored in
|
||||
* \c surface->format. Once you are done accessing the surface, you should
|
||||
* use SDL_UnlockSurface() to release it.
|
||||
*
|
||||
*
|
||||
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
|
||||
* to 0, then you can read and write to the surface at any time, and the
|
||||
* pixel format of the surface will not change.
|
||||
*
|
||||
*
|
||||
* No operating system or library calls should be made between lock/unlock
|
||||
* pairs, as critical system locks may be held during this time.
|
||||
*
|
||||
*
|
||||
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
|
||||
*
|
||||
*
|
||||
* \sa SDL_UnlockSurface()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
|
||||
|
@ -166,11 +164,11 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
|
|||
|
||||
/**
|
||||
* Load a surface from a seekable SDL data stream (memory or file).
|
||||
*
|
||||
*
|
||||
* If \c freesrc is non-zero, the stream will be closed after being read.
|
||||
*
|
||||
*
|
||||
* The new surface should be freed with SDL_FreeSurface().
|
||||
*
|
||||
*
|
||||
* \return the new surface, or NULL if there was an error.
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
|
||||
|
@ -178,34 +176,34 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
|
|||
|
||||
/**
|
||||
* Load a surface from a file.
|
||||
*
|
||||
*
|
||||
* Convenience macro.
|
||||
*/
|
||||
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
|
||||
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
|
||||
|
||||
/**
|
||||
* Save a surface to a seekable SDL data stream (memory or file).
|
||||
*
|
||||
*
|
||||
* If \c freedst is non-zero, the stream will be closed after being written.
|
||||
*
|
||||
*
|
||||
* \return 0 if successful or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
||||
(SDL_Surface * surface, SDL_RWops * dst, int freedst);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Save a surface to a file.
|
||||
*
|
||||
*
|
||||
* Convenience macro.
|
||||
*/
|
||||
#define SDL_SaveBMP(surface, file) \
|
||||
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
||||
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
||||
|
||||
/**
|
||||
* \brief Sets the RLE acceleration hint for a surface.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid
|
||||
*
|
||||
*
|
||||
* \note If RLE is enabled, colorkey and alpha blending blits are much faster,
|
||||
* but the surface must be locked before directly accessing the pixels.
|
||||
*/
|
||||
|
@ -214,11 +212,11 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Sets the color key (transparent pixel) in a blittable surface.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to update
|
||||
* \param flag Non-zero to enable colorkey and 0 to disable colorkey
|
||||
* \param key The transparent pixel in the native surface format
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid
|
||||
*
|
||||
* You can pass SDL_RLEACCEL to enable RLE accelerated blits.
|
||||
|
@ -228,12 +226,12 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Gets the color key (transparent pixel) in a blittable surface.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to update
|
||||
* \param key A pointer filled in with the transparent pixel in the native
|
||||
* \param key A pointer filled in with the transparent pixel in the native
|
||||
* surface format
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid or colorkey is not
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid or colorkey is not
|
||||
* enabled.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
|
||||
|
@ -241,14 +239,14 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Set an additional color value used in blit operations.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to update.
|
||||
* \param r The red color value multiplied into blit operations.
|
||||
* \param g The green color value multiplied into blit operations.
|
||||
* \param b The blue color value multiplied into blit operations.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetSurfaceColorMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
|
||||
|
@ -257,14 +255,14 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Get the additional color value used in blit operations.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to query.
|
||||
* \param r A pointer filled in with the current red color value.
|
||||
* \param g A pointer filled in with the current green color value.
|
||||
* \param b A pointer filled in with the current blue color value.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetSurfaceColorMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
|
||||
|
@ -273,12 +271,12 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Set an additional alpha value used in blit operations.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to update.
|
||||
* \param alpha The alpha value multiplied into blit operations.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetSurfaceAlphaMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
|
||||
|
@ -286,12 +284,12 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Get the additional alpha value used in blit operations.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to query.
|
||||
* \param alpha A pointer filled in with the current alpha value.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetSurfaceAlphaMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
|
||||
|
@ -299,12 +297,12 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Set the blend mode used for blit operations.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to update.
|
||||
* \param blendMode ::SDL_BlendMode to use for blit blending.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the parameters are not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetSurfaceBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
||||
|
@ -312,12 +310,12 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* \brief Get the blend mode used for blit operations.
|
||||
*
|
||||
*
|
||||
* \param surface The surface to query.
|
||||
* \param blendMode A pointer filled in with the current blend mode.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetSurfaceBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
||||
|
@ -325,14 +323,14 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* Sets the clipping rectangle for the destination surface in a blit.
|
||||
*
|
||||
*
|
||||
* If the clip rectangle is NULL, clipping will be disabled.
|
||||
*
|
||||
*
|
||||
* If the clip rectangle doesn't intersect the surface, the function will
|
||||
* return SDL_FALSE and blits will be completely clipped. Otherwise the
|
||||
* function returns SDL_TRUE and blits to the surface will be clipped to
|
||||
* the intersection of the surface area and the clipping rectangle.
|
||||
*
|
||||
*
|
||||
* Note that blits are automatically clipped to the edges of the source
|
||||
* and destination surfaces.
|
||||
*/
|
||||
|
@ -341,7 +339,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
|
|||
|
||||
/**
|
||||
* Gets the clipping rectangle for the destination surface in a blit.
|
||||
*
|
||||
*
|
||||
* \c rect must be a pointer to a valid rectangle which will be filled
|
||||
* with the correct values.
|
||||
*/
|
||||
|
@ -349,11 +347,11 @@ extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
|
|||
SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* Creates a new surface of the specified format, and then copies and maps
|
||||
* the given surface to it so the blit of the converted surface will be as
|
||||
* Creates a new surface of the specified format, and then copies and maps
|
||||
* the given surface to it so the blit of the converted surface will be as
|
||||
* fast as possible. If this function fails, it returns NULL.
|
||||
*
|
||||
* The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
|
||||
*
|
||||
* The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
|
||||
* semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and
|
||||
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
|
||||
* surface.
|
||||
|
@ -365,7 +363,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
|
|||
|
||||
/**
|
||||
* \brief Copy a block of pixels of one format to another format
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if there was an error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
||||
|
@ -376,12 +374,12 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
|||
|
||||
/**
|
||||
* Performs a fast fill of the given rectangle with \c color.
|
||||
*
|
||||
*
|
||||
* If \c rect is NULL, the whole surface will be filled with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_FillRect
|
||||
|
@ -391,12 +389,12 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||
|
||||
/**
|
||||
* Performs a fast blit from the source surface to the destination surface.
|
||||
*
|
||||
*
|
||||
* This assumes that the source and destination rectangles are
|
||||
* the same size. If either \c srcrect or \c dstrect are NULL, the entire
|
||||
* surface (\c src or \c dst) is copied. The final blit rectangles are saved
|
||||
* in \c srcrect and \c dstrect after all clipping is performed.
|
||||
*
|
||||
*
|
||||
* \return If the blit is successful, it returns 0, otherwise it returns -1.
|
||||
*
|
||||
* The blit function should not be called on a locked surface.
|
||||
|
@ -413,7 +411,7 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
RGB values of the source color key, ignoring alpha in the
|
||||
comparison.
|
||||
|
||||
|
||||
RGB->RGBA:
|
||||
SDL_SRCALPHA set:
|
||||
alpha-blend (using the source per-surface alpha value);
|
||||
|
@ -423,7 +421,7 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||
both:
|
||||
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
source color key.
|
||||
|
||||
|
||||
RGBA->RGBA:
|
||||
SDL_SRCALPHA set:
|
||||
alpha-blend (using the source alpha channel) the RGB values;
|
||||
|
@ -434,8 +432,8 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
RGB values of the source color key, ignoring alpha in the
|
||||
comparison.
|
||||
|
||||
RGB->RGB:
|
||||
|
||||
RGB->RGB:
|
||||
SDL_SRCALPHA set:
|
||||
alpha-blend (using the source per-surface alpha value).
|
||||
SDL_SRCALPHA not set:
|
||||
|
@ -444,7 +442,7 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|||
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
source color key.
|
||||
\endverbatim
|
||||
*
|
||||
*
|
||||
* You should call SDL_BlitSurface() unless you know exactly how SDL
|
||||
* blitting works internally and how to use the other blit functions.
|
||||
*/
|
||||
|
@ -469,7 +467,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit
|
|||
/**
|
||||
* \brief Perform a fast, low quality, stretch blit between two surfaces of the
|
||||
* same pixel format.
|
||||
*
|
||||
*
|
||||
* \note This function uses a static buffer, and is not thread-safe.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
|
||||
|
@ -498,9 +496,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_system.h
|
||||
*
|
||||
*
|
||||
* Include file for platform specific SDL API functions
|
||||
*/
|
||||
|
||||
|
@ -38,9 +38,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Platform specific functions for iOS */
|
||||
|
@ -98,9 +96,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_syswm.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL custom system window manager hooks.
|
||||
*/
|
||||
|
||||
|
@ -36,14 +36,12 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file SDL_syswm.h
|
||||
*
|
||||
*
|
||||
* Your application has access to a special type of event ::SDL_SYSWMEVENT,
|
||||
* which contains window-manager specific information and arrives whenever
|
||||
* an unhandled window event occurs. This event is ignored by default, but
|
||||
|
@ -95,7 +93,7 @@ typedef struct _UIWindow UIWindow;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
/**
|
||||
* These are the various supported windowing subsystems
|
||||
*/
|
||||
typedef enum
|
||||
|
@ -209,14 +207,14 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
|||
/* Function prototypes */
|
||||
/**
|
||||
* \brief This function allows access to driver-dependent window information.
|
||||
*
|
||||
*
|
||||
* \param window The window about which information is being requested
|
||||
* \param info This structure must be initialized with the SDL version, and is
|
||||
* \param info This structure must be initialized with the SDL version, and is
|
||||
* then filled in with information about the given window.
|
||||
*
|
||||
* \return SDL_TRUE if the function is implemented and the version member of
|
||||
*
|
||||
* \return SDL_TRUE if the function is implemented and the version member of
|
||||
* the \c info struct is valid, SDL_FALSE otherwise.
|
||||
*
|
||||
*
|
||||
* You typically use this function like this:
|
||||
* \code
|
||||
* SDL_SysWMinfo info;
|
||||
|
@ -230,9 +228,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
|
@ -46,24 +46,20 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Global definitions */
|
||||
|
||||
/*
|
||||
* Note: Maximum size of SDLTest log message is less than SDLs limit
|
||||
* to ensure we can fit additional information such as the timestamp.
|
||||
/*
|
||||
* Note: Maximum size of SDLTest log message is less than SDLs limit
|
||||
* to ensure we can fit additional information such as the timestamp.
|
||||
*/
|
||||
#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
|
||||
#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_assert.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
*
|
||||
* Assert API for test code and test cases
|
||||
*
|
||||
|
@ -39,20 +39,18 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Fails the assert.
|
||||
*/
|
||||
#define ASSERT_FAIL 0
|
||||
#define ASSERT_FAIL 0
|
||||
|
||||
/**
|
||||
* \brief Passes the assert.
|
||||
*/
|
||||
#define ASSERT_PASS 1
|
||||
#define ASSERT_PASS 1
|
||||
|
||||
/**
|
||||
* \brief Assert that logs and break execution flow on failures.
|
||||
|
@ -98,9 +96,7 @@ void SDLTest_LogAssertSummary();
|
|||
int SDLTest_AssertSummaryToTestResult();
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_common.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
|
@ -109,9 +109,7 @@ typedef struct
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
@ -175,9 +173,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_compare.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
Defines comparison functions (i.e. for surfaces).
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _SDL_test_compare_h
|
||||
|
@ -43,9 +43,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -58,13 +56,11 @@ extern "C" {
|
|||
* \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
|
||||
*/
|
||||
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
|
||||
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_crc32.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
Implements CRC32 calculations (default output is Perl String::CRC32 compatible).
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _SDL_test_crc32_h
|
||||
|
@ -39,9 +39,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -50,20 +48,20 @@ extern "C" {
|
|||
/* Definition shared by all CRC routines */
|
||||
|
||||
#ifndef CrcUint32
|
||||
#define CrcUint32 unsigned int
|
||||
#define CrcUint32 unsigned int
|
||||
#endif
|
||||
#ifndef CrcUint8
|
||||
#define CrcUint8 unsigned char
|
||||
#define CrcUint8 unsigned char
|
||||
#endif
|
||||
|
||||
#ifdef ORIGINAL_METHOD
|
||||
#define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
|
||||
#define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
|
||||
#else
|
||||
#define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Data structure for CRC32 (checksum) computation
|
||||
/**
|
||||
* Data structure for CRC32 (checksum) computation
|
||||
*/
|
||||
typedef struct {
|
||||
CrcUint32 crc32_table[256]; /* CRC table */
|
||||
|
@ -71,12 +69,12 @@ extern "C" {
|
|||
|
||||
/* ---------- Function Prototypes ------------- */
|
||||
|
||||
/**
|
||||
/**
|
||||
* /brief Initialize the CRC context
|
||||
*
|
||||
* Note: The function initializes the crc table required for all crc calculations.
|
||||
*
|
||||
* /param crcContext pointer to context variable
|
||||
* /param crcContext pointer to context variable
|
||||
*
|
||||
* /returns 0 for OK, -1 on error
|
||||
*
|
||||
|
@ -86,8 +84,8 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* /brief calculate a crc32 from a data block
|
||||
*
|
||||
* /param crcContext pointer to context variable
|
||||
*
|
||||
* /param crcContext pointer to context variable
|
||||
* /param inBuf input buffer to checksum
|
||||
* /param inLen length of input buffer
|
||||
* /param crc32 pointer to Uint32 to store the final CRC into
|
||||
|
@ -106,7 +104,7 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf,
|
|||
/**
|
||||
* /brief clean up CRC context
|
||||
*
|
||||
* /param crcContext pointer to context variable
|
||||
* /param crcContext pointer to context variable
|
||||
*
|
||||
* /returns 0 for OK, -1 on error
|
||||
*
|
||||
|
@ -117,9 +115,7 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_font.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
|
@ -33,9 +33,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
@ -55,9 +53,7 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_fuzzer.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
Data generators for fuzzing test data in a reproducible way.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _SDL_test_fuzzer_h
|
||||
|
@ -39,9 +39,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -131,7 +129,7 @@ Sint64 SDLTest_RandomSint64();
|
|||
float SDLTest_RandomUnitFloat();
|
||||
|
||||
/**
|
||||
* \returns random double in range [0.0 - 1.0[
|
||||
* \returns random double in range [0.0 - 1.0[
|
||||
*/
|
||||
double SDLTest_RandomUnitDouble();
|
||||
|
||||
|
@ -333,7 +331,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
|
|||
|
||||
/**
|
||||
* Generates random null-terminated string. The minimum length for
|
||||
* the string is 1 character, maximum length for the string is 255
|
||||
* the string is 1 character, maximum length for the string is 255
|
||||
* characters and it can contain ASCII characters from 32 to 126.
|
||||
*
|
||||
* Note: Returned string needs to be deallocated.
|
||||
|
@ -352,7 +350,7 @@ char * SDLTest_RandomAsciiString();
|
|||
*
|
||||
* \param maxLength The maximum length of the generated string.
|
||||
*
|
||||
* \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
|
||||
* \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
|
||||
*/
|
||||
char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
|
||||
|
||||
|
@ -377,9 +375,7 @@ int SDLTest_GetFuzzerInvocationCount();
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_harness.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
/*
|
||||
Defines types for test case definitions and the test execution harness API.
|
||||
|
||||
|
||||
Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
|
||||
*/
|
||||
|
||||
|
@ -39,9 +39,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -50,17 +48,17 @@ extern "C" {
|
|||
#define TEST_DISABLED 0
|
||||
|
||||
//! Definition of all the possible test return values of the test case method
|
||||
#define TEST_ABORTED -1
|
||||
#define TEST_STARTED 0
|
||||
#define TEST_COMPLETED 1
|
||||
#define TEST_SKIPPED 2
|
||||
#define TEST_ABORTED -1
|
||||
#define TEST_STARTED 0
|
||||
#define TEST_COMPLETED 1
|
||||
#define TEST_SKIPPED 2
|
||||
|
||||
//! Definition of all the possible test results for the harness
|
||||
#define TEST_RESULT_PASSED 0
|
||||
#define TEST_RESULT_FAILED 1
|
||||
#define TEST_RESULT_NO_ASSERT 2
|
||||
#define TEST_RESULT_SKIPPED 3
|
||||
#define TEST_RESULT_SETUP_FAILURE 4
|
||||
#define TEST_RESULT_PASSED 0
|
||||
#define TEST_RESULT_FAILED 1
|
||||
#define TEST_RESULT_NO_ASSERT 2
|
||||
#define TEST_RESULT_SKIPPED 3
|
||||
#define TEST_RESULT_SETUP_FAILURE 4
|
||||
|
||||
//!< Function pointer to a test case setup function (run before every test)
|
||||
typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
|
||||
|
@ -75,28 +73,28 @@ typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
|
|||
* Holds information about a single test case.
|
||||
*/
|
||||
typedef struct SDLTest_TestCaseReference {
|
||||
/*!< Func2Stress */
|
||||
SDLTest_TestCaseFp testCase;
|
||||
/*!< Short name (or function name) "Func2Stress" */
|
||||
char *name;
|
||||
/*!< Long name or full description "This test pushes func2() to the limit." */
|
||||
char *description;
|
||||
/*!< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
|
||||
int enabled;
|
||||
/*!< Func2Stress */
|
||||
SDLTest_TestCaseFp testCase;
|
||||
/*!< Short name (or function name) "Func2Stress" */
|
||||
char *name;
|
||||
/*!< Long name or full description "This test pushes func2() to the limit." */
|
||||
char *description;
|
||||
/*!< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
|
||||
int enabled;
|
||||
} SDLTest_TestCaseReference;
|
||||
|
||||
/**
|
||||
* Holds information about a test suite (multiple test cases).
|
||||
*/
|
||||
typedef struct SDLTest_TestSuiteReference {
|
||||
/*!< "PlatformSuite" */
|
||||
char *name;
|
||||
/*!< The function that is run before each test. NULL skips. */
|
||||
SDLTest_TestCaseSetUpFp testSetUp;
|
||||
/*!< The test cases that are run as part of the suite. Last item should be NULL. */
|
||||
const SDLTest_TestCaseReference **testCases;
|
||||
/*!< The function that is run after each test. NULL skips. */
|
||||
SDLTest_TestCaseTearDownFp testTearDown;
|
||||
/*!< "PlatformSuite" */
|
||||
char *name;
|
||||
/*!< The function that is run before each test. NULL skips. */
|
||||
SDLTest_TestCaseSetUpFp testSetUp;
|
||||
/*!< The test cases that are run as part of the suite. Last item should be NULL. */
|
||||
const SDLTest_TestCaseReference **testCases;
|
||||
/*!< The function that is run after each test. NULL skips. */
|
||||
SDLTest_TestCaseTearDownFp testTearDown;
|
||||
} SDLTest_TestSuiteReference;
|
||||
|
||||
|
||||
|
@ -112,13 +110,11 @@ typedef struct SDLTest_TestSuiteReference {
|
|||
* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
|
||||
*/
|
||||
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations);
|
||||
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_images.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
Defines some images for tests.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _SDL_test_images_h
|
||||
|
@ -41,9 +41,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -52,7 +50,7 @@ extern "C" {
|
|||
typedef struct SDLTest_SurfaceImage_s {
|
||||
int width;
|
||||
int height;
|
||||
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
|
||||
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
|
||||
const char *pixel_data;
|
||||
} SDLTest_SurfaceImage_t;
|
||||
|
||||
|
@ -71,9 +69,7 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend();
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_log.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
*
|
||||
* Wrapper to log in the TEST category
|
||||
*
|
||||
|
@ -39,9 +39,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -60,9 +58,7 @@ void SDLTest_LogError(const char *fmt, ...);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_md5.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
|
@ -59,9 +59,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* ------------ Definitions --------- */
|
||||
|
@ -71,21 +69,21 @@ extern "C" {
|
|||
|
||||
/* Data structure for MD5 (Message-Digest) computation */
|
||||
typedef struct {
|
||||
MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
|
||||
MD5UINT4 buf[4]; /* scratch buffer */
|
||||
unsigned char in[64]; /* input buffer */
|
||||
unsigned char digest[16]; /* actual digest after Md5Final call */
|
||||
MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
|
||||
MD5UINT4 buf[4]; /* scratch buffer */
|
||||
unsigned char in[64]; /* input buffer */
|
||||
unsigned char digest[16]; /* actual digest after Md5Final call */
|
||||
} SDLTest_Md5Context;
|
||||
|
||||
/* ---------- Function Prototypes ------------- */
|
||||
|
||||
/**
|
||||
/**
|
||||
* /brief initialize the context
|
||||
*
|
||||
* /param mdContext pointer to context variable
|
||||
* /param mdContext pointer to context variable
|
||||
*
|
||||
* Note: The function initializes the message-digest context
|
||||
* mdContext. Call before each new use of the context -
|
||||
* mdContext. Call before each new use of the context -
|
||||
* all fields are set to zero.
|
||||
*/
|
||||
void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
|
||||
|
@ -93,24 +91,24 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* /brief update digest from variable length data
|
||||
*
|
||||
*
|
||||
* /param mdContext pointer to context variable
|
||||
* /param inBuf pointer to data array/string
|
||||
* /param inLen length of data array/string
|
||||
*
|
||||
* Note: The function updates the message-digest context to account
|
||||
* Note: The function updates the message-digest context to account
|
||||
* for the presence of each of the characters inBuf[0..inLen-1]
|
||||
* in the message whose digest is being computed.
|
||||
*/
|
||||
|
||||
void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
|
||||
unsigned int inLen);
|
||||
unsigned int inLen);
|
||||
|
||||
|
||||
/*
|
||||
* /brief complete digest computation
|
||||
*
|
||||
* /param mdContext pointer to context variable
|
||||
* /param mdContext pointer to context variable
|
||||
*
|
||||
* Note: The function terminates the message-digest computation and
|
||||
* ends with the desired message digest in mdContext.digest[0..15].
|
||||
|
@ -122,9 +120,7 @@ extern "C" {
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,20 +21,20 @@
|
|||
|
||||
/**
|
||||
* \file SDL_test_random.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
A "32-bit Multiply with carry random number generator. Very fast.
|
||||
Includes a list of recommended multipliers.
|
||||
A "32-bit Multiply with carry random number generator. Very fast.
|
||||
Includes a list of recommended multipliers.
|
||||
|
||||
multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32.
|
||||
period: (a*2^31)-1
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _SDL_test_random_h
|
||||
|
@ -43,9 +43,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* --- Definitions */
|
||||
|
@ -53,7 +51,7 @@ extern "C" {
|
|||
/*
|
||||
* Macros that return a random number in a specific format.
|
||||
*/
|
||||
#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c))
|
||||
#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c))
|
||||
|
||||
/*
|
||||
* Context structure for the random number generator state.
|
||||
|
@ -70,7 +68,7 @@ extern "C" {
|
|||
/* --- Function prototypes */
|
||||
|
||||
/**
|
||||
* \brief Initialize random number generator with two integers.
|
||||
* \brief Initialize random number generator with two integers.
|
||||
*
|
||||
* Note: The random sequence of numbers returned by ...Random() is the
|
||||
* same for the same two integers and has a period of 2^31.
|
||||
|
@ -81,10 +79,10 @@ extern "C" {
|
|||
*
|
||||
*/
|
||||
void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
|
||||
unsigned int ci);
|
||||
unsigned int ci);
|
||||
|
||||
/**
|
||||
* \brief Initialize random number generator based on current system time.
|
||||
* \brief Initialize random number generator based on current system time.
|
||||
*
|
||||
* \param rndContext pointer to context structure
|
||||
*
|
||||
|
@ -93,7 +91,7 @@ extern "C" {
|
|||
|
||||
|
||||
/**
|
||||
* \brief Initialize random number generator based on current system time.
|
||||
* \brief Initialize random number generator based on current system time.
|
||||
*
|
||||
* Note: ...RandomInit() or ...RandomInitTime() must have been called
|
||||
* before using this function.
|
||||
|
@ -108,9 +106,7 @@ extern "C" {
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_thread.h
|
||||
*
|
||||
*
|
||||
* Header for the SDL thread management routines.
|
||||
*/
|
||||
|
||||
|
@ -37,9 +37,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* The SDL thread structure, defined in SDL_thread.c */
|
||||
|
@ -67,22 +65,22 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
|
|||
#if defined(__WIN32__) && !defined(HAVE_LIBC)
|
||||
/**
|
||||
* \file SDL_thread.h
|
||||
*
|
||||
*
|
||||
* We compile SDL into a DLL. This means, that it's the DLL which
|
||||
* creates a new thread for the calling process with the SDL_CreateThread()
|
||||
* API. There is a problem with this, that only the RTL of the SDL.DLL will
|
||||
* be initialized for those threads, and not the RTL of the calling
|
||||
* be initialized for those threads, and not the RTL of the calling
|
||||
* application!
|
||||
*
|
||||
*
|
||||
* To solve this, we make a little hack here.
|
||||
*
|
||||
*
|
||||
* We'll always use the caller's _beginthread() and _endthread() APIs to
|
||||
* start a new thread. This way, if it's the SDL.DLL which uses this API,
|
||||
* then the RTL of SDL.DLL will be used to create the new thread, and if it's
|
||||
* the application, then the RTL of the application will be used.
|
||||
*
|
||||
*
|
||||
* So, in short:
|
||||
* Always use the _beginthread() and _endthread() of the calling runtime
|
||||
* Always use the _beginthread() and _endthread() of the calling runtime
|
||||
* library!
|
||||
*/
|
||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
|
@ -150,7 +148,7 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
|
|||
|
||||
/**
|
||||
* Get the thread identifier for the specified thread.
|
||||
*
|
||||
*
|
||||
* Equivalent to SDL_ThreadID() if the specified thread is NULL.
|
||||
*/
|
||||
extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
|
||||
|
@ -162,7 +160,7 @@ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
|
|||
|
||||
/**
|
||||
* Wait for a thread to finish.
|
||||
*
|
||||
*
|
||||
* The return code for the thread function is placed in the area
|
||||
* pointed to by \c status, if \c status is not NULL.
|
||||
*/
|
||||
|
@ -171,9 +169,7 @@ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_timer.h
|
||||
*
|
||||
*
|
||||
* Header for the SDL time management routines.
|
||||
*/
|
||||
|
||||
|
@ -34,14 +34,12 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Get the number of milliseconds since the SDL library initialization.
|
||||
*
|
||||
*
|
||||
* \note This value wraps if the program runs for more than ~49 days.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
||||
|
@ -63,7 +61,7 @@ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
|||
|
||||
/**
|
||||
* Function prototype for the timer callback function.
|
||||
*
|
||||
*
|
||||
* The callback function is passed the current timer interval and returns
|
||||
* the next timer interval. If the returned value is the same as the one
|
||||
* passed in, the periodic alarm continues, otherwise a new alarm is
|
||||
|
@ -97,9 +95,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_touch.h
|
||||
*
|
||||
*
|
||||
* Include file for SDL touch event handling.
|
||||
*/
|
||||
|
||||
|
@ -35,9 +35,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
typedef Sint64 SDL_TouchID;
|
||||
|
@ -79,9 +77,7 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_types.h
|
||||
*
|
||||
*
|
||||
* \deprecated
|
||||
*/
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_version.h
|
||||
*
|
||||
*
|
||||
* This header defines the current SDL version.
|
||||
*/
|
||||
|
||||
|
@ -33,20 +33,18 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Information the version of SDL in use.
|
||||
*
|
||||
*
|
||||
* Represents the library's version as three levels: major revision
|
||||
* (increments with massive changes, additions, and enhancements),
|
||||
* minor revision (increments with backwards-compatible changes to the
|
||||
* major revision), and patchlevel (increments with fixes to the minor
|
||||
* revision).
|
||||
*
|
||||
*
|
||||
* \sa SDL_VERSION
|
||||
* \sa SDL_GetVersion
|
||||
*/
|
||||
|
@ -59,30 +57,30 @@ typedef struct SDL_version
|
|||
|
||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 0
|
||||
#define SDL_PATCHLEVEL 0
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 0
|
||||
#define SDL_PATCHLEVEL 0
|
||||
|
||||
/**
|
||||
* \brief Macro to determine SDL version program was compiled against.
|
||||
*
|
||||
*
|
||||
* This macro fills in a SDL_version structure with the version of the
|
||||
* library you compiled against. This is determined by what header the
|
||||
* compiler uses. Note that if you dynamically linked the library, you might
|
||||
* have a slightly newer or older version at runtime. That version can be
|
||||
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
|
||||
* is not a macro.
|
||||
*
|
||||
*
|
||||
* \param x A pointer to a SDL_version struct to initialize.
|
||||
*
|
||||
*
|
||||
* \sa SDL_version
|
||||
* \sa SDL_GetVersion
|
||||
*/
|
||||
#define SDL_VERSION(x) \
|
||||
{ \
|
||||
(x)->major = SDL_MAJOR_VERSION; \
|
||||
(x)->minor = SDL_MINOR_VERSION; \
|
||||
(x)->patch = SDL_PATCHLEVEL; \
|
||||
#define SDL_VERSION(x) \
|
||||
{ \
|
||||
(x)->major = SDL_MAJOR_VERSION; \
|
||||
(x)->minor = SDL_MINOR_VERSION; \
|
||||
(x)->patch = SDL_PATCHLEVEL; \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,23 +88,23 @@ typedef struct SDL_version
|
|||
* \verbatim
|
||||
(1,2,3) -> (1203)
|
||||
\endverbatim
|
||||
*
|
||||
*
|
||||
* This assumes that there will never be more than 100 patchlevels.
|
||||
*/
|
||||
#define SDL_VERSIONNUM(X, Y, Z) \
|
||||
((X)*1000 + (Y)*100 + (Z))
|
||||
#define SDL_VERSIONNUM(X, Y, Z) \
|
||||
((X)*1000 + (Y)*100 + (Z))
|
||||
|
||||
/**
|
||||
* This is the version number macro for the current SDL version.
|
||||
*/
|
||||
#define SDL_COMPILEDVERSION \
|
||||
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
||||
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
||||
|
||||
/**
|
||||
* This macro will evaluate to true if compiled with SDL at least X.Y.Z.
|
||||
*/
|
||||
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
||||
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
||||
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
||||
|
||||
/**
|
||||
* \brief Get the version of SDL that is linked against your program.
|
||||
|
@ -115,11 +113,11 @@ typedef struct SDL_version
|
|||
* current version will be different than the version you compiled against.
|
||||
* This function returns the current version, while SDL_VERSION() is a
|
||||
* macro that tells you what version you compiled with.
|
||||
*
|
||||
*
|
||||
* \code
|
||||
* SDL_version compiled;
|
||||
* SDL_version linked;
|
||||
*
|
||||
*
|
||||
* SDL_VERSION(&compiled);
|
||||
* SDL_GetVersion(&linked);
|
||||
* printf("We compiled against SDL version %d.%d.%d ...\n",
|
||||
|
@ -127,9 +125,9 @@ typedef struct SDL_version
|
|||
* printf("But we linked against SDL version %d.%d.%d.\n",
|
||||
* linked.major, linked.minor, linked.patch);
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* This function may be called safely at any time, even before SDL_Init().
|
||||
*
|
||||
*
|
||||
* \sa SDL_VERSION
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
|
||||
|
@ -155,9 +153,7 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file SDL_video.h
|
||||
*
|
||||
*
|
||||
* Header file for SDL video functions.
|
||||
*/
|
||||
|
||||
|
@ -36,14 +36,12 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The structure that defines a display mode
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetNumDisplayModes()
|
||||
* \sa SDL_GetDisplayMode()
|
||||
* \sa SDL_GetDesktopDisplayMode()
|
||||
|
@ -63,7 +61,7 @@ typedef struct
|
|||
|
||||
/**
|
||||
* \brief The type used to identify a window
|
||||
*
|
||||
*
|
||||
* \sa SDL_CreateWindow()
|
||||
* \sa SDL_CreateWindowFrom()
|
||||
* \sa SDL_DestroyWindow()
|
||||
|
@ -92,7 +90,7 @@ typedef struct SDL_Window SDL_Window;
|
|||
|
||||
/**
|
||||
* \brief The flags on a window
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowFlags()
|
||||
*/
|
||||
typedef enum
|
||||
|
@ -108,7 +106,7 @@ typedef enum
|
|||
SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
|
||||
SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
|
||||
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
|
||||
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
|
||||
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
|
||||
SDL_WINDOW_FOREIGN = 0x00000800 /**< window not created by SDL */
|
||||
} SDL_WindowFlags;
|
||||
|
||||
|
@ -138,9 +136,9 @@ typedef enum
|
|||
SDL_WINDOWEVENT_NONE, /**< Never used */
|
||||
SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
|
||||
SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
|
||||
SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
|
||||
SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
|
||||
redrawn */
|
||||
SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
|
||||
SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
|
||||
*/
|
||||
SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
|
||||
SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */
|
||||
|
@ -152,7 +150,7 @@ typedef enum
|
|||
SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
|
||||
SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
|
||||
SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
|
||||
SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the
|
||||
SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the
|
||||
window be closed */
|
||||
} SDL_WindowEventID;
|
||||
|
||||
|
@ -211,52 +209,52 @@ typedef enum
|
|||
|
||||
/**
|
||||
* \brief Get the number of video drivers compiled into SDL
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetVideoDriver()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
|
||||
|
||||
/**
|
||||
* \brief Get the name of a built in video driver.
|
||||
*
|
||||
*
|
||||
* \note The video drivers are presented in the order in which they are
|
||||
* normally checked during initialization.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetNumVideoDrivers()
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
|
||||
|
||||
/**
|
||||
* \brief Initialize the video subsystem, optionally specifying a video driver.
|
||||
*
|
||||
* \param driver_name Initialize a specific driver by name, or NULL for the
|
||||
*
|
||||
* \param driver_name Initialize a specific driver by name, or NULL for the
|
||||
* default video driver.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, -1 on error
|
||||
*
|
||||
*
|
||||
* This function initializes the video subsystem; setting up a connection
|
||||
* to the window manager, etc, and determines the available display modes
|
||||
* and pixel formats, but does not initialize a window or graphics mode.
|
||||
*
|
||||
*
|
||||
* \sa SDL_VideoQuit()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
|
||||
|
||||
/**
|
||||
* \brief Shuts down the video subsystem.
|
||||
*
|
||||
*
|
||||
* This function closes all windows, and restores the original video mode.
|
||||
*
|
||||
*
|
||||
* \sa SDL_VideoInit()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
|
||||
|
||||
/**
|
||||
* \brief Returns the name of the currently initialized video driver.
|
||||
*
|
||||
*
|
||||
* \return The name of the current video driver or NULL if no driver
|
||||
* has been initialized
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetNumVideoDrivers()
|
||||
* \sa SDL_GetVideoDriver()
|
||||
*/
|
||||
|
@ -264,16 +262,16 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
|
|||
|
||||
/**
|
||||
* \brief Returns the number of available video displays.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetDisplayBounds()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
|
||||
|
||||
/**
|
||||
* \brief Get the name of a display in UTF-8 encoding
|
||||
*
|
||||
*
|
||||
* \return The name of a display, or NULL for an invalid display index.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetNumVideoDisplays()
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
|
||||
|
@ -281,29 +279,29 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
|
|||
/**
|
||||
* \brief Get the desktop area represented by a display, with the primary
|
||||
* display located at 0,0
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the index is out of range.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetNumVideoDisplays()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* \brief Returns the number of available display modes.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetDisplayMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
|
||||
|
||||
/**
|
||||
* \brief Fill in information about a specific display mode.
|
||||
*
|
||||
*
|
||||
* \note The display modes are sorted in this priority:
|
||||
* \li bits per pixel -> more colors to fewer colors
|
||||
* \li width -> largest to smallest
|
||||
* \li height -> largest to smallest
|
||||
* \li refresh rate -> highest to lowest
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetNumDisplayModes()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
|
||||
|
@ -322,22 +320,22 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
|
|||
|
||||
/**
|
||||
* \brief Get the closest match to the requested display mode.
|
||||
*
|
||||
*
|
||||
* \param displayIndex The index of display from which mode should be queried.
|
||||
* \param mode The desired display mode
|
||||
* \param closest A pointer to a display mode to be filled in with the closest
|
||||
* \param closest A pointer to a display mode to be filled in with the closest
|
||||
* match of the available display modes.
|
||||
*
|
||||
* \return The passed in value \c closest, or NULL if no matching video mode
|
||||
*
|
||||
* \return The passed in value \c closest, or NULL if no matching video mode
|
||||
* was available.
|
||||
*
|
||||
*
|
||||
* The available display modes are scanned, and \c closest is filled in with the
|
||||
* closest mode matching the requested mode and returned. The mode format and
|
||||
* refresh_rate default to the desktop mode if they are 0. The modes are
|
||||
* scanned with size being first priority, format being second priority, and
|
||||
* finally checking the refresh_rate. If all the available modes are too
|
||||
* closest mode matching the requested mode and returned. The mode format and
|
||||
* refresh_rate default to the desktop mode if they are 0. The modes are
|
||||
* scanned with size being first priority, format being second priority, and
|
||||
* finally checking the refresh_rate. If all the available modes are too
|
||||
* small, then NULL is returned.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetNumDisplayModes()
|
||||
* \sa SDL_GetDisplayMode()
|
||||
*/
|
||||
|
@ -345,7 +343,7 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayI
|
|||
|
||||
/**
|
||||
* \brief Get the display index associated with a window.
|
||||
*
|
||||
*
|
||||
* \return the display index of the display containing the center of the
|
||||
* window, or -1 on error.
|
||||
*/
|
||||
|
@ -356,12 +354,12 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
|
|||
*
|
||||
* By default the window's dimensions and the desktop format and refresh rate
|
||||
* are used.
|
||||
*
|
||||
*
|
||||
* \param window The window for which the display mode should be set.
|
||||
* \param mode The mode to use, or NULL for the default mode.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if setting the display mode failed.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowDisplayMode()
|
||||
* \sa SDL_SetWindowFullscreen()
|
||||
*/
|
||||
|
@ -386,22 +384,22 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
|
|||
|
||||
/**
|
||||
* \brief Create a window with the specified position, dimensions, and flags.
|
||||
*
|
||||
*
|
||||
* \param title The title of the window, in UTF-8 encoding.
|
||||
* \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* ::SDL_WINDOWPOS_UNDEFINED.
|
||||
* \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
* ::SDL_WINDOWPOS_UNDEFINED.
|
||||
* \param w The width of the window.
|
||||
* \param h The height of the window.
|
||||
* \param flags The flags for the window, a mask of any of the following:
|
||||
* ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
|
||||
* ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS,
|
||||
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
|
||||
* \param flags The flags for the window, a mask of any of the following:
|
||||
* ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
|
||||
* ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS,
|
||||
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
|
||||
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED.
|
||||
*
|
||||
*
|
||||
* \return The id of the window created, or zero if window creation failed.
|
||||
*
|
||||
*
|
||||
* \sa SDL_DestroyWindow()
|
||||
*/
|
||||
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
|
||||
|
@ -410,11 +408,11 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
|
|||
|
||||
/**
|
||||
* \brief Create an SDL window from an existing native window.
|
||||
*
|
||||
*
|
||||
* \param data A pointer to driver-dependent window creation data
|
||||
*
|
||||
*
|
||||
* \return The id of the window created, or zero if window creation failed.
|
||||
*
|
||||
*
|
||||
* \sa SDL_DestroyWindow()
|
||||
*/
|
||||
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
|
||||
|
@ -436,7 +434,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
|
|||
|
||||
/**
|
||||
* \brief Set the title of a window, in UTF-8 format.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowTitle()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
|
||||
|
@ -444,14 +442,14 @@ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Get the title of a window, in UTF-8 format.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetWindowTitle()
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Set the icon for a window.
|
||||
*
|
||||
*
|
||||
* \param window The window for which the icon should be set.
|
||||
* \param icon The icon for the window.
|
||||
*/
|
||||
|
@ -460,7 +458,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Associate an arbitrary named pointer with a window.
|
||||
*
|
||||
*
|
||||
* \param window The window to associate with the pointer.
|
||||
* \param name The name of the pointer.
|
||||
* \param userdata The associated pointer.
|
||||
|
@ -477,12 +475,12 @@ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Retrieve the data pointer associated with a window.
|
||||
*
|
||||
*
|
||||
* \param window The window to query.
|
||||
* \param name The name of the pointer.
|
||||
*
|
||||
* \return The value associated with 'name'
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetWindowData()
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
|
||||
|
@ -490,15 +488,15 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Set the position of a window.
|
||||
*
|
||||
*
|
||||
* \param window The window to reposition.
|
||||
* \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
::SDL_WINDOWPOS_UNDEFINED.
|
||||
* \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
|
||||
::SDL_WINDOWPOS_UNDEFINED.
|
||||
*
|
||||
*
|
||||
* \note The window coordinate origin is the upper left of the display.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowPosition()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
|
||||
|
@ -506,7 +504,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Get the position of a window.
|
||||
*
|
||||
*
|
||||
* \param window The window to query.
|
||||
* \param x Pointer to variable for storing the x position, may be NULL
|
||||
* \param y Pointer to variable for storing the y position, may be NULL
|
||||
|
@ -518,14 +516,14 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Set the size of a window's client area.
|
||||
*
|
||||
*
|
||||
* \param window The window to resize.
|
||||
* \param w The width of the window, must be >0
|
||||
* \param h The height of the window, must be >0
|
||||
*
|
||||
* \note You can't change the size of a fullscreen window, it automatically
|
||||
* matches the size of the display mode.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowSize()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
|
||||
|
@ -533,19 +531,19 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
|
|||
|
||||
/**
|
||||
* \brief Get the size of a window's client area.
|
||||
*
|
||||
*
|
||||
* \param window The window to query.
|
||||
* \param w Pointer to variable for storing the width, may be NULL
|
||||
* \param h Pointer to variable for storing the height, may be NULL
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetWindowSize()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
|
||||
int *h);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set the minimum size of a window's client area.
|
||||
*
|
||||
*
|
||||
* \param window The window to set a new minimum size.
|
||||
* \param min_w The minimum width of the window, must be >0
|
||||
* \param min_h The minimum height of the window, must be >0
|
||||
|
@ -558,14 +556,14 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
|
|||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
|
||||
int min_w, int min_h);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get the minimum size of a window's client area.
|
||||
*
|
||||
*
|
||||
* \param window The window to query.
|
||||
* \param w Pointer to variable for storing the minimum width, may be NULL
|
||||
* \param h Pointer to variable for storing the minimum height, may be NULL
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowMaximumSize()
|
||||
* \sa SDL_SetWindowMinimumSize()
|
||||
*/
|
||||
|
@ -587,10 +585,10 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
|
|||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
|
||||
int max_w, int max_h);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get the maximum size of a window's client area.
|
||||
*
|
||||
*
|
||||
* \param window The window to query.
|
||||
* \param w Pointer to variable for storing the maximum width, may be NULL
|
||||
* \param h Pointer to variable for storing the maximum height, may be NULL
|
||||
|
@ -612,7 +610,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
|
|||
* \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
|
||||
*
|
||||
* \note You can't change the border state of a fullscreen window.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowFlags()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
|
||||
|
@ -620,14 +618,14 @@ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Show a window.
|
||||
*
|
||||
*
|
||||
* \sa SDL_HideWindow()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Hide a window.
|
||||
*
|
||||
*
|
||||
* \sa SDL_ShowWindow()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
|
||||
|
@ -639,21 +637,21 @@ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
|
|||
|
||||
/**
|
||||
* \brief Make a window as large as possible.
|
||||
*
|
||||
*
|
||||
* \sa SDL_RestoreWindow()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Minimize a window to an iconic representation.
|
||||
*
|
||||
*
|
||||
* \sa SDL_RestoreWindow()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Restore the size and position of a minimized or maximized window.
|
||||
*
|
||||
*
|
||||
* \sa SDL_MaximizeWindow()
|
||||
* \sa SDL_MinimizeWindow()
|
||||
*/
|
||||
|
@ -661,9 +659,9 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
|
|||
|
||||
/**
|
||||
* \brief Set a window's fullscreen state.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if setting the display mode failed.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetWindowDisplayMode()
|
||||
* \sa SDL_GetWindowDisplayMode()
|
||||
*/
|
||||
|
@ -673,7 +671,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
|
|||
/**
|
||||
* \brief Get the SDL surface associated with the window.
|
||||
*
|
||||
* \return The window's framebuffer surface, or NULL on error.
|
||||
* \return The window's framebuffer surface, or NULL on error.
|
||||
*
|
||||
* A new surface will be created with the optimal format for the window,
|
||||
* if necessary. This surface will be freed when the window is destroyed.
|
||||
|
@ -709,10 +707,10 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Set a window's input grab mode.
|
||||
*
|
||||
*
|
||||
* \param window The window for which the input grab mode should be set.
|
||||
* \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowGrab()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
|
||||
|
@ -720,18 +718,18 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Get a window's input grab mode.
|
||||
*
|
||||
*
|
||||
* \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetWindowGrab()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Set the brightness (gamma correction) for a window.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if setting the brightness isn't supported.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GetWindowBrightness()
|
||||
* \sa SDL_SetWindowGammaRamp()
|
||||
*/
|
||||
|
@ -739,23 +737,23 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b
|
|||
|
||||
/**
|
||||
* \brief Get the brightness (gamma correction) for a window.
|
||||
*
|
||||
*
|
||||
* \return The last brightness value passed to SDL_SetWindowBrightness()
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetWindowBrightness()
|
||||
*/
|
||||
extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Set the gamma ramp for a window.
|
||||
*
|
||||
*
|
||||
* \param window The window for which the gamma ramp should be set.
|
||||
* \param red The translation table for the red channel, or NULL.
|
||||
* \param green The translation table for the green channel, or NULL.
|
||||
* \param blue The translation table for the blue channel, or NULL.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if gamma ramps are unsupported.
|
||||
*
|
||||
*
|
||||
* Set the gamma translation table for the red, green, and blue channels
|
||||
* of the video hardware. Each table is an array of 256 16-bit quantities,
|
||||
* representing a mapping between the input and output for that channel.
|
||||
|
@ -771,17 +769,17 @@ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Get the gamma ramp for a window.
|
||||
*
|
||||
*
|
||||
* \param window The window from which the gamma ramp should be queried.
|
||||
* \param red A pointer to a 256 element array of 16-bit quantities to hold
|
||||
* \param red A pointer to a 256 element array of 16-bit quantities to hold
|
||||
* the translation table for the red channel, or NULL.
|
||||
* \param green A pointer to a 256 element array of 16-bit quantities to hold
|
||||
* \param green A pointer to a 256 element array of 16-bit quantities to hold
|
||||
* the translation table for the green channel, or NULL.
|
||||
* \param blue A pointer to a 256 element array of 16-bit quantities to hold
|
||||
* \param blue A pointer to a 256 element array of 16-bit quantities to hold
|
||||
* the translation table for the blue channel, or NULL.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if gamma ramps are unsupported.
|
||||
*
|
||||
*
|
||||
* \sa SDL_SetWindowGammaRamp()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
|
||||
|
@ -797,7 +795,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
|
|||
|
||||
/**
|
||||
* \brief Returns whether the screensaver is currently enabled (default on).
|
||||
*
|
||||
*
|
||||
* \sa SDL_EnableScreenSaver()
|
||||
* \sa SDL_DisableScreenSaver()
|
||||
*/
|
||||
|
@ -805,7 +803,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
|
|||
|
||||
/**
|
||||
* \brief Allow the screen to be blanked by a screensaver
|
||||
*
|
||||
*
|
||||
* \sa SDL_IsScreenSaverEnabled()
|
||||
* \sa SDL_DisableScreenSaver()
|
||||
*/
|
||||
|
@ -813,7 +811,7 @@ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
|
|||
|
||||
/**
|
||||
* \brief Prevent the screen from being blanked by a screensaver
|
||||
*
|
||||
*
|
||||
* \sa SDL_IsScreenSaverEnabled()
|
||||
* \sa SDL_EnableScreenSaver()
|
||||
*/
|
||||
|
@ -827,19 +825,19 @@ extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
|
|||
|
||||
/**
|
||||
* \brief Dynamically load an OpenGL library.
|
||||
*
|
||||
* \param path The platform dependent OpenGL library name, or NULL to open the
|
||||
*
|
||||
* \param path The platform dependent OpenGL library name, or NULL to open the
|
||||
* default OpenGL library.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if the library couldn't be loaded.
|
||||
*
|
||||
*
|
||||
* This should be done after initializing the video driver, but before
|
||||
* creating any OpenGL windows. If no OpenGL library is loaded, the default
|
||||
* library will be loaded upon creation of the first OpenGL window.
|
||||
*
|
||||
*
|
||||
* \note If you do this, you need to retrieve all of the GL functions used in
|
||||
* your program from the dynamic library using SDL_GL_GetProcAddress().
|
||||
*
|
||||
*
|
||||
* \sa SDL_GL_GetProcAddress()
|
||||
* \sa SDL_GL_UnloadLibrary()
|
||||
*/
|
||||
|
@ -852,13 +850,13 @@ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
|
|||
|
||||
/**
|
||||
* \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
|
||||
*
|
||||
*
|
||||
* \sa SDL_GL_LoadLibrary()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
|
||||
|
||||
/**
|
||||
* \brief Return true if an OpenGL extension is supported for the current
|
||||
* \brief Return true if an OpenGL extension is supported for the current
|
||||
* context.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
|
||||
|
@ -875,9 +873,9 @@ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
|
|||
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
|
||||
|
||||
/**
|
||||
* \brief Create an OpenGL context for use with an OpenGL window, and make it
|
||||
* \brief Create an OpenGL context for use with an OpenGL window, and make it
|
||||
* current.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GL_DeleteContext()
|
||||
*/
|
||||
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
|
||||
|
@ -885,7 +883,7 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
|
|||
|
||||
/**
|
||||
* \brief Set up an OpenGL context for rendering into an OpenGL window.
|
||||
*
|
||||
*
|
||||
* \note The context must have been created with a compatible window.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
|
||||
|
@ -893,40 +891,40 @@ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
|
|||
|
||||
/**
|
||||
* \brief Set the swap interval for the current OpenGL context.
|
||||
*
|
||||
*
|
||||
* \param interval 0 for immediate updates, 1 for updates synchronized with the
|
||||
* vertical retrace. If the system supports it, you may
|
||||
* specify -1 to allow late swaps to happen immediately
|
||||
* instead of waiting for the next retrace.
|
||||
*
|
||||
*
|
||||
* \return 0 on success, or -1 if setting the swap interval is not supported.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GL_GetSwapInterval()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
|
||||
|
||||
/**
|
||||
* \brief Get the swap interval for the current OpenGL context.
|
||||
*
|
||||
* \return 0 if there is no vertical retrace synchronization, 1 if the buffer
|
||||
*
|
||||
* \return 0 if there is no vertical retrace synchronization, 1 if the buffer
|
||||
* swap is synchronized with the vertical retrace, and -1 if late
|
||||
* swaps happen immediately instead of waiting for the next retrace.
|
||||
* If the system can't determine the swap interval, or there isn't a
|
||||
* valid current context, this will return 0 as a safe default.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GL_SetSwapInterval()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
|
||||
|
||||
/**
|
||||
* \brief Swap the OpenGL buffers for a window, if double-buffering is
|
||||
* \brief Swap the OpenGL buffers for a window, if double-buffering is
|
||||
* supported.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Delete an OpenGL context.
|
||||
*
|
||||
*
|
||||
* \sa SDL_GL_CreateContext()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
|
||||
|
@ -936,9 +934,7 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -37,23 +37,23 @@
|
|||
#ifndef DECLSPEC
|
||||
# if defined(__BEOS__) || defined(__HAIKU__)
|
||||
# if defined(__GNUC__)
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# else
|
||||
# define DECLSPEC __declspec(export)
|
||||
# define DECLSPEC __declspec(export)
|
||||
# endif
|
||||
# elif defined(__WIN32__)
|
||||
# ifdef __BORLANDC__
|
||||
# ifdef BUILD_SDL
|
||||
# define DECLSPEC
|
||||
# else
|
||||
# define DECLSPEC __declspec(dllimport)
|
||||
# define DECLSPEC __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define DECLSPEC __attribute__ ((visibility("default")))
|
||||
# define DECLSPEC __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define DECLSPEC
|
||||
# endif
|
||||
|
@ -106,7 +106,7 @@
|
|||
defined(__WATCOMC__) || defined(__LCC__) || \
|
||||
defined(__DECC)
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
#define SDL_INLINE_OKAY
|
||||
#else
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/**
|
||||
* \file close_code.h
|
||||
*
|
||||
*
|
||||
* This file reverses the effects of begin_code.h and should be included
|
||||
* after you finish any function and structure declarations in your headers
|
||||
*/
|
||||
|
|
26
src/SDL.c
26
src/SDL.c
|
@ -138,7 +138,7 @@ SDL_InitSubSystem(Uint32 flags)
|
|||
}
|
||||
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER)) {
|
||||
// Game controller implies Joystick.
|
||||
/* Game controller implies Joystick. */
|
||||
flags |= SDL_INIT_JOYSTICK;
|
||||
}
|
||||
|
||||
|
@ -221,19 +221,19 @@ SDL_QuitSubSystem(Uint32 flags)
|
|||
/* Shut down requested initialized subsystems */
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER)) {
|
||||
// Game controller implies Joystick.
|
||||
/* Game controller implies Joystick. */
|
||||
flags |= SDL_INIT_JOYSTICK;
|
||||
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
SDL_GameControllerQuit();
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMECONTROLLER);
|
||||
}
|
||||
|
||||
if ((flags & SDL_INIT_JOYSTICK)) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_JOYSTICK)) {
|
||||
SDL_JoystickQuit();
|
||||
}
|
||||
SDL_JoystickQuit();
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_JOYSTICK);
|
||||
}
|
||||
#endif
|
||||
|
@ -241,8 +241,8 @@ SDL_QuitSubSystem(Uint32 flags)
|
|||
#if !SDL_HAPTIC_DISABLED
|
||||
if ((flags & SDL_INIT_HAPTIC)) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
|
||||
SDL_HapticQuit();
|
||||
}
|
||||
SDL_HapticQuit();
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_HAPTIC);
|
||||
}
|
||||
#endif
|
||||
|
@ -250,8 +250,8 @@ SDL_QuitSubSystem(Uint32 flags)
|
|||
#if !SDL_AUDIO_DISABLED
|
||||
if ((flags & SDL_INIT_AUDIO)) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) {
|
||||
SDL_AudioQuit();
|
||||
}
|
||||
SDL_AudioQuit();
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_AUDIO);
|
||||
}
|
||||
#endif
|
||||
|
@ -259,8 +259,8 @@ SDL_QuitSubSystem(Uint32 flags)
|
|||
#if !SDL_VIDEO_DISABLED
|
||||
if ((flags & SDL_INIT_VIDEO)) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) {
|
||||
SDL_VideoQuit();
|
||||
}
|
||||
SDL_VideoQuit();
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_VIDEO);
|
||||
}
|
||||
#endif
|
||||
|
@ -268,8 +268,8 @@ SDL_QuitSubSystem(Uint32 flags)
|
|||
#if !SDL_TIMERS_DISABLED
|
||||
if ((flags & SDL_INIT_TIMER)) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) {
|
||||
SDL_TimerQuit();
|
||||
}
|
||||
SDL_TimerQuit();
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_TIMER);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
#if SDL_THREADS_DISABLED
|
||||
/* The default (non-thread-safe) global error variable */
|
||||
static SDL_error SDL_global_error;
|
||||
#define SDL_GetErrBuf() (&SDL_global_error)
|
||||
#define SDL_GetErrBuf() (&SDL_global_error)
|
||||
#else
|
||||
extern SDL_error *SDL_GetErrBuf(void);
|
||||
#endif /* SDL_THREADS_DISABLED */
|
||||
|
||||
#define SDL_ERRBUFIZE 1024
|
||||
#define SDL_ERRBUFIZE 1024
|
||||
|
||||
/* Private functions */
|
||||
|
||||
|
@ -57,7 +57,7 @@ SDL_SetError(const char *fmt, ...)
|
|||
|
||||
/* Ignore call if invalid format pointer was passed */
|
||||
if (fmt == NULL) return -1;
|
||||
|
||||
|
||||
/* Copy in the key, mark error as valid */
|
||||
error = SDL_GetErrBuf();
|
||||
error->error = 1;
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#ifndef _SDL_error_c_h
|
||||
#define _SDL_error_c_h
|
||||
|
||||
#define ERR_MAX_STRLEN 128
|
||||
#define ERR_MAX_ARGS 5
|
||||
#define ERR_MAX_STRLEN 128
|
||||
#define ERR_MAX_ARGS 5
|
||||
|
||||
typedef struct SDL_error
|
||||
{
|
||||
|
|
|
@ -41,14 +41,14 @@ SDL_bool
|
|||
SDL_RegisterHintChangedCb(const char *name, SDL_HintChangedCb hintCb)
|
||||
{
|
||||
SDL_Hint *hint;
|
||||
|
||||
|
||||
for (hint = SDL_hints; hint; hint = hint->next) {
|
||||
if (SDL_strcmp(name, hint->name) == 0) {
|
||||
hint->callback = hintCb;
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
|
|
@ -138,7 +138,7 @@ SDL_LogGetPriority(int category)
|
|||
}
|
||||
|
||||
if (category == SDL_LOG_CATEGORY_TEST) {
|
||||
return SDL_test_priority;
|
||||
return SDL_test_priority;
|
||||
} else if (category == SDL_LOG_CATEGORY_APPLICATION) {
|
||||
return SDL_application_priority;
|
||||
} else if (category == SDL_LOG_CATEGORY_ASSERT) {
|
||||
|
@ -328,19 +328,18 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
|
|||
}
|
||||
}
|
||||
#elif defined(__PSP__)
|
||||
//Simple Log System for PSP
|
||||
{
|
||||
unsigned int length;
|
||||
char* output;
|
||||
FILE* pFile;
|
||||
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
|
||||
{
|
||||
unsigned int length;
|
||||
char* output;
|
||||
FILE* pFile;
|
||||
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
|
||||
output = SDL_stack_alloc(char, length);
|
||||
SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
|
||||
pFile = fopen ("SDL_Log.txt", "a");
|
||||
fwrite (output, strlen (output), 1, pFile);
|
||||
SDL_stack_free(output);
|
||||
fclose (pFile);
|
||||
}
|
||||
SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
|
||||
pFile = fopen ("SDL_Log.txt", "a");
|
||||
fwrite (output, strlen (output), 1, pFile);
|
||||
SDL_stack_free(output);
|
||||
fclose (pFile);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_STDIO_H
|
||||
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
*/
|
||||
#undef SDL_AtomicCAS
|
||||
#undef SDL_AtomicCASPtr
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
If any of the operations are not provided then we must emulate some
|
||||
of them. That means we need a nice implementation of spin locks
|
||||
that avoids the "one big lock" problem. We use a vector of spin
|
||||
|
@ -40,7 +40,7 @@
|
|||
To generate the index of the lock we first shift by 3 bits to get
|
||||
rid on the zero bits that result from 32 and 64 bit allignment of
|
||||
data. We then mask off all but 5 bits and use those 5 bits as an
|
||||
index into the table.
|
||||
index into the table.
|
||||
|
||||
Picking the lock this way insures that accesses to the same data at
|
||||
the same time will go to the same lock. OTOH, accesses to different
|
||||
|
|
|
@ -76,11 +76,11 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
|
|||
return (result == 0);
|
||||
|
||||
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
int result;
|
||||
__asm__ __volatile__(
|
||||
int result;
|
||||
__asm__ __volatile__(
|
||||
"lock ; xchgl %0, (%1)\n"
|
||||
: "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
|
||||
return (result == 0);
|
||||
return (result == 0);
|
||||
|
||||
#elif defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
|
||||
|
@ -114,10 +114,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock)
|
|||
|
||||
#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
|
||||
__sync_lock_release(lock);
|
||||
|
||||
|
||||
#elif HAVE_PTHREAD_SPINLOCK
|
||||
pthread_spin_unlock(lock);
|
||||
|
||||
|
||||
#else
|
||||
*lock = 0;
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue