Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/graphics/sdl_videomem.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ void G_writeChar(int x, int y, const char c[256], Uint32 color) {
}

SDL_UnlockTexture(G_videomem);

G_render();
}

#endif
14 changes: 3 additions & 11 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <pthread.h>

static int fps = 25;
static pthread_t emulator_thread;

void quit() {
Expand Down Expand Up @@ -91,17 +90,10 @@ int main(int argc, char *argv[]) {
Uint64 ticksStart = SDL_GetTicks64();

SDL_Event event;
while (SDL_PollEvent(&event))
handleEvent(event);
if (!SDL_WaitEvent(&event))
G_error();

G_render();

Uint64 ticksEnd = SDL_GetTicks64();

Uint64 ticksPassed = ticksEnd - ticksStart;
Uint64 ticksLeft = ticksPassed * 1000 / fps;

SDL_Delay(ticksLeft);
handleEvent(event);
}

quit();
Expand Down