SDLGameEngine

SgeControl

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.

Detailed Description

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.

See also:
sgeGameStateNew

Define Documentation

#define sgeGameLoop (   event,
  quitvar 
)    while ((SDL_WaitEvent(&event)&&(!quit)))

The actual game loop.

Parameters:
eventA SGEEVENT variable to handle the events
quitvarA 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.

Parameters:
timerThe timer ID returned by sgeAddTimer

Definition at line 48 of file sgecontrol.h.

#define sgeStartGame (   function,
  fps 
)
Value:

A shortcut to start a game.

Parameters:
functionA function pointer to your main game loop
fpsThe 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.


Function Documentation

SGETIMER sgeAddTimer ( int  ms,
void *  function 
)

Add a function which is called in a regular time interval.

Parameters:
msMiliseconds the function is called
functionA function pointer to call
Returns:
A SGETIMER handle

Definition at line 13 of file sgecontrol.c.

SGETIMER sgeStartRedrawTimer ( int  fps)

Start the timer system.

Parameters:
fpsThe frames per second to call the SGEREDRAW event
Returns:
A SGETIMER handle

Definition at line 35 of file sgecontrol.c.

void sgeStopRedrawTimer ( SGETIMER  sgetimer)

Stop the timer.

Parameters:
sgetimerThe SGETIMER handle

Definition at line 40 of file sgecontrol.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines