|
SDLGameEngine
|
Low level control functions. More...
Defines | |
| #define | SGEREDRAW 0xf00 |
| #define | SGETIMER SDL_TimerID |
| #define | sgeRemoveTimer(timer) SDL_RemoveTimer(timer) |
| Remove a timer from the event system. | |
| #define | sgeGameLoop(event, quitvar) while ((SDL_WaitEvent(&event)&&(!quit))) |
| The actual game loop. | |
| #define | sgeStartGame(function, fps) |
| A shortcut to start a game. | |
Functions | |
| SGETIMER | sgeAddTimer (int ms, void *function) |
| Add a function which is called in a regular time interval. | |
| SGETIMER | sgeStartRedrawTimer (int fps) |
| Start the timer system. | |
| void | sgeStopRedrawTimer (SGETIMER sgetimer) |
| Stop the timer. | |
| Uint32 | sgeGetFPS (void) |
| Check the frames per second the game is currently running. | |
Low level control functions.
Functions for managing timing and gameloops. These are mostly for internal tasks or for complex requirements. In most cases you should use the gamestate system.
| #define sgeGameLoop | ( | event, | |
| quitvar | |||
| ) | while ((SDL_WaitEvent(&event)&&(!quit))) |
The actual game loop.
| event | A SGEEVENT variable to handle the events |
| quitvar | A integer variable which ends the gameloop when set to 1 |
Definition at line 55 of file sgecontrol.h.
| #define SGEREDRAW 0xf00 |
The redraw event ID
Definition at line 36 of file sgecontrol.h.
| #define sgeRemoveTimer | ( | timer | ) | SDL_RemoveTimer(timer) |
Remove a timer from the event system.
| timer | The timer ID returned by sgeAddTimer |
Definition at line 48 of file sgecontrol.h.
| #define sgeStartGame | ( | function, | |
| fps | |||
| ) |
SGETIMER t=sgeStartRedrawTimer(fps);\ function();\ sgeStopRedrawTimer(t);
A shortcut to start a game.
| function | A function pointer to your main game loop |
| fps | The frames per second the game should run |
Definition at line 62 of file sgecontrol.h.
| #define SGETIMER SDL_TimerID |
The timer ID, currently only a alias to SDL_TimerID, but may change
Definition at line 42 of file sgecontrol.h.
| SGETIMER sgeAddTimer | ( | int | ms, |
| void * | function | ||
| ) |
Add a function which is called in a regular time interval.
| ms | Miliseconds the function is called |
| function | A function pointer to call |
Definition at line 13 of file sgecontrol.c.
| SGETIMER sgeStartRedrawTimer | ( | int | fps | ) |
Start the timer system.
| fps | The frames per second to call the SGEREDRAW event |
Definition at line 35 of file sgecontrol.c.
| void sgeStopRedrawTimer | ( | SGETIMER | sgetimer | ) |