summary refs log tree commit diff stats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-02-23 10:49:56 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-02-23 10:49:56 -0500
commit0751446e1d069263d25abcff49a32a380231709a (patch)
treeaf47582053b30d018c3f1d02e0462aa1eab1b6bb /src/main.cpp
parentcecdba5cd996cea3ebd2534aea7a3e3a41205b9c (diff)
downloadtherapy-0751446e1d069263d25abcff49a32a380231709a.tar.gz
therapy-0751446e1d069263d25abcff49a32a380231709a.tar.bz2
therapy-0751446e1d069263d25abcff49a32a380231709a.zip
Rewrote bloom so it's not super slow, also removed the frame from the screen mesh
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index 62c8b16..bc7832d 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -42,22 +42,24 @@ int main()
42 curGameState = new MapView(m, 100, 100); 42 curGameState = new MapView(m, 100, 100);
43 43
44 Texture* buffer = createTexture(GAME_WIDTH, GAME_HEIGHT); 44 Texture* buffer = createTexture(GAME_WIDTH, GAME_HEIGHT);
45 //Texture* buffer = loadTextureFromBMP("../res/title.png");
45 46
46 double lastTime = glfwGetTime(); 47 double lastTime = glfwGetTime();
47 double accum = 0.0; 48 int nbFrames = 0;
48 49
49 while (!(quit || glfwWindowShouldClose(window))) 50 while (!(quit || glfwWindowShouldClose(window)))
50 { 51 {
51 // Tick! 52 double currentTime = glfwGetTime();
52 accum += (glfwGetTime() - lastTime); 53 nbFrames++;
53 if (accum < 0) accum = 0; 54 if (currentTime - lastTime >= 1.0)
54 while (accum > SECONDS_PER_FRAME)
55 { 55 {
56 curGameState->tick(); 56 // printf and reset timer
57 accum -= SECONDS_PER_FRAME; 57 printf("%f ms/frame\n", 1000.0/double(nbFrames));
58 nbFrames = 0;
59 lastTime += 1.0;
58 } 60 }
59 61
60 lastTime = glfwGetTime(); 62 curGameState->tick();
61 63
62 // Do rendering 64 // Do rendering
63 curGameState->render(buffer); 65 curGameState->render(buffer);