Contains routines for synchronizing your game.
#define oslSetFrameskip |
( |
|
val | ) |
(osl_frameskip = val) |
Sets the current fix frameskipping value.
- Parameters
-
val | 1 = enables auto frameskip 2 or more: enables fixed skipping (val-1 frames out of val are skipped) |
#define oslSetMaxFrameskip |
( |
|
val | ) |
(osl_maxFrameskip = val) |
Sets the maximum frameskip value. If you set a too high value, the game may become unusable when lagging, if you set a too low value, frameskip is no more useful.
#define oslSetVSync |
( |
|
val | ) |
(osl_vsyncEnabled = val) |
Sets the VSync parameter.
- Parameters
-
val | 0: Automatic VSync (enabled if the game is not lagging). 1: VSync always enabled. +4: If you add 4, with a frameskip > 1, synchronizes to the wanted framerate, e.g. 2 -> 30 fps (DON'T USE THIS ANYMORE) +0: Else, fixes the minimum frameskip (e.g. 2: the game will run at 60 fps, 30 images per second, that is one frame out of two is skipped) +8: Alternative synchronization method without VSync +16: Do not swap buffers. Handy if you want temporary to "disable double buffering". |
#define oslSyncFrame |
( |
| ) |
oslSyncFrameEx(osl_frameskip,osl_maxFrameskip,osl_vsyncEnabled) |
Synchronization. Call it to the end of a frame. A frame is one step when animating your game. The PSP LCD refreshes at 60 images per second (and thus, you'll have to generate 60 frames per second). This function uses the frameskip & vsync parameters defined above.
- Returns
- A boolean value indicating if you're in late.
Note: When you're indicated to be in late, you should skip the rendering to speed up things, else your game will slow down. Usually the whole render is surrounded by a "if (!skip)" block, and when skip is true, the render is completely skipped. Skip is the return value from oslSyncFrame.
Here is the structure of an automatically frameskipped program:
int skip = 0;
while(1) {
if (!skip) {
}
}
Call this function when a frame has ended, just before a call to oslSyncFrame or oslWaitVSync or anything. Important: If you are calling this function, you do not need to call oslAudioVSync anymore. Newer programs should always call oslEndFrame instead.
int oslSyncFrameEx |
( |
int |
frameskip, |
|
|
int |
max_frameskip, |
|
|
int |
vsync |
|
) |
| |
Same as oslSyncFrame but with all parameters set in one call. This method is a bit cleaner because the other one stores parameters in global variables and oslSyncFrame calls oslSyncFrameEx with them as arguments.
void oslSetFramerate |
( |
int |
framerate | ) |
|
|
inline |
Sets the framerate for oslSyncFrame(Ex). This can be any value from 1 to 60. For example, use 50 to simulate a PAL (european) game.
Waits for the VSync (60 times per second), synchronizing your game. This is a simplier and less efficient method than oslSyncFrame.
This variable is set to TRUE to indicate the application should exit (happens when the user pressed HOME and selected Yes). You should always keep an eye on this variable, clean up everything and then quit when this variable has become TRUE.