From cd48894563052baeddff64f6bbc13ccc7fa6e081 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 19 Feb 2015 20:10:11 -0500 Subject: Added CRT mesh! Also a character sprite, changed up the map file format, fixed some shader bugs --- src/main.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 2a1d9ea..ec485e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,20 +30,31 @@ int main() glfwSwapInterval(1); glfwSetKeyCallback(window, key_callback); - Map* m = new Map("../maps/bigmap.txt"); - Map* m2 = new Map("../maps/cozy.txt"); + Map* m = new Map("../maps/embarass.txt"); + //Map* m2 = new Map("../maps/cozy.txt"); - m->setLeftMap(m2); - m2->setRightMap(m); + //m->setLeftMap(m2); + //m2->setRightMap(m); curGameState = new MapView(m, 100, 100); Texture* buffer = createTexture(GAME_WIDTH, GAME_HEIGHT); + double lastTime = glfwGetTime(); + double accum = 0.0; + while (!(quit || glfwWindowShouldClose(window))) { // Tick! - curGameState->tick(); + accum += (glfwGetTime() - lastTime); + if (accum < 0) accum = 0; + while (accum > SECONDS_PER_FRAME) + { + curGameState->tick(); + accum -= SECONDS_PER_FRAME; + } + + lastTime = glfwGetTime(); // Do rendering curGameState->render(buffer); -- cgit 1.4.1