SDL
2.0
|
Go to the source code of this file.
Macros | |
#define | DAMPING 0.5f; /* after bouncing off a wall, damping coefficient determines final speed */ |
#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 */ |
#define | SDL_IPHONE_MAX_GFORCE 5.0f |
#define | SINT16_MAX ((float)(0x7FFF)) |
Functions | |
void | render (SDL_Renderer *renderer, int w, int h, double deltaTime) |
void | initializeTextures (SDL_Renderer *renderer) |
int | main (int argc, char *argv[]) |
Variables | |
static SDL_Joystick * | accelerometer |
struct { | |
float x | |
float y | |
float vx | |
float vy | |
SDL_Rect rect | |
} | shipData |
static SDL_Texture * | ship = 0 |
static SDL_Texture * | space = 0 |
#define DAMPING 0.5f; /* after bouncing off a wall, damping coefficient determines final speed */ |
Definition at line 11 of file accelerometer.c.
Referenced by render().
#define FRICTION 0.0008f /* coefficient of acceleration that opposes direction of motion */ |
Definition at line 12 of file accelerometer.c.
Referenced by render().
#define GRAVITY_CONSTANT 0.004f /* how sensitive the ship is to the accelerometer */ |
Definition at line 13 of file accelerometer.c.
Referenced by render().
#define SDL_IPHONE_MAX_GFORCE 5.0f |
Definition at line 17 of file accelerometer.c.
Referenced by render().
#define SINT16_MAX ((float)(0x7FFF)) |
Referenced by render().
void initializeTextures | ( | SDL_Renderer * | renderer | ) |
Definition at line 114 of file accelerometer.c.
References fatalError(), SDL_Surface::format, SDL_Surface::h, NULL, SDL_BLENDMODE_BLEND, SDL_CreateTextureFromSurface, SDL_FreeSurface, SDL_LoadBMP, SDL_MapRGB, SDL_SetColorKey, SDL_SetTextureBlendMode, shipData, and SDL_Surface::w.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 158 of file accelerometer.c.
References accelerometer, done, fatalError(), initializeTextures(), NULL, render(), renderer, SDL_CreateRenderer, SDL_CreateWindow, SDL_Delay, SDL_DestroyTexture, SDL_GetWindowSize, SDL_Init, SDL_INIT_JOYSTICK, SDL_INIT_VIDEO, SDL_JoystickName, SDL_JoystickNumAxes, SDL_JoystickNumBalls, SDL_JoystickNumButtons, SDL_JoystickNumHats, SDL_JoystickOpen, SDL_NumJoysticks, SDL_PollEvent, SDL_Quit, SDL_QUIT, SDL_RenderSetLogicalSize, SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_FULLSCREEN, shipData, SDL_Event::type, and updateDeltaTime().
void render | ( | SDL_Renderer * | renderer, |
int | w, | ||
int | h, | ||
double | deltaTime | ||
) |
Definition at line 33 of file accelerometer.c.
References accelerometer, DAMPING, FRICTION, GRAVITY_CONSTANT, NULL, SDL_IPHONE_MAX_GFORCE, SDL_JoystickGetAxis, SDL_RenderCopy, SDL_RenderPresent, shipData, and SINT16_MAX.
Referenced by main().
|
static |
Definition at line 20 of file accelerometer.c.
Referenced by IOS_AddJoystickDevice(), main(), and render().
SDL_Rect rect |
Definition at line 26 of file accelerometer.c.
|
static |
Definition at line 29 of file accelerometer.c.
struct { ... } shipData |
Referenced by initializeTextures(), main(), and render().
|
static |
Definition at line 30 of file accelerometer.c.
float vx |
Definition at line 25 of file accelerometer.c.
float vy |
Definition at line 25 of file accelerometer.c.
float x |
Definition at line 24 of file accelerometer.c.
float y |
Definition at line 24 of file accelerometer.c.