mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-25 21:14:22 +01:00
Same delay as Frodo
This commit is contained in:
parent
9b138afacc
commit
f5e1ad6aa5
9
main.cpp
9
main.cpp
@ -8,11 +8,16 @@
|
|||||||
SDL_Surface *screen;
|
SDL_Surface *screen;
|
||||||
C64 *TheC64;
|
C64 *TheC64;
|
||||||
|
|
||||||
|
#define MS_PER_FRAME 28
|
||||||
|
|
||||||
static void run(void)
|
static void run(void)
|
||||||
{
|
{
|
||||||
|
Uint32 last_frame = SDL_GetTicks();
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
SDL_Event ev;
|
SDL_Event ev;
|
||||||
|
Uint32 now = SDL_GetTicks();
|
||||||
|
|
||||||
while (SDL_PollEvent(&ev)) {
|
while (SDL_PollEvent(&ev)) {
|
||||||
if (ev.type == SDL_QUIT)
|
if (ev.type == SDL_QUIT)
|
||||||
@ -24,7 +29,9 @@ static void run(void)
|
|||||||
Gui::gui->draw(screen);
|
Gui::gui->draw(screen);
|
||||||
|
|
||||||
SDL_Flip(screen);
|
SDL_Flip(screen);
|
||||||
SDL_Delay(50);
|
|
||||||
|
if ( (now - last_frame) < MS_PER_FRAME)
|
||||||
|
SDL_Delay( MS_PER_FRAME - (now - last_frame));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user