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; }