From 7a2bd633e502cf2c63f8aeb6b6374998f5e585df Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Tue, 15 Dec 2020 13:33:34 -0500 Subject: [PATCH] use renDoRenderLoop() in hello_world example --- examples/hello_world/main.cpp | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/examples/hello_world/main.cpp b/examples/hello_world/main.cpp index 98a9049..1113839 100644 --- a/examples/hello_world/main.cpp +++ b/examples/hello_world/main.cpp @@ -1,40 +1,16 @@ -#include - #include "renderer.h" int main() { - render_state* rs = renInit(); + render_state* rs = renInit("Hello World"); if (rs == nullptr) return 1; - const uint TARGET_FPS = 60; - const uint FRAME_DELAY = 1000 / TARGET_FPS; - uint frameStart, frameTime; - bool running = true; - SDL_Event e; - - while (running) { - frameStart = SDL_GetTicks(); - - while (SDL_PollEvent(&e)) { - if ((e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_ESCAPE) - || e.type == SDL_QUIT) { - running = false; - } - } - - renRenderFrame(rs); - SDL_GL_SwapWindow(rs->handles.window); - frameTime = SDL_GetTicks() - frameStart; - - if (FRAME_DELAY > frameTime) - SDL_Delay(FRAME_DELAY - frameTime); - } + renDoRenderLoop(rs); return 0; }