summary refs log tree commit diff stats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-02-19 20:10:11 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-02-19 20:10:11 -0500
commitcd48894563052baeddff64f6bbc13ccc7fa6e081 (patch)
treec7ab2a9b4cbb7ac0d921cf486aef00c5b5623144 /src/main.cpp
parentc1b1558256997df22678f6405ea320ae454ad5b4 (diff)
downloadtherapy-cd48894563052baeddff64f6bbc13ccc7fa6e081.tar.gz
therapy-cd48894563052baeddff64f6bbc13ccc7fa6e081.tar.bz2
therapy-cd48894563052baeddff64f6bbc13ccc7fa6e081.zip
Added CRT mesh!
Also a character sprite, changed up the map file format, fixed some shader bugs
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp21
1 files changed, 16 insertions, 5 deletions
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()
30 glfwSwapInterval(1); 30 glfwSwapInterval(1);
31 glfwSetKeyCallback(window, key_callback); 31 glfwSetKeyCallback(window, key_callback);
32 32
33 Map* m = new Map("../maps/bigmap.txt"); 33 Map* m = new Map("../maps/embarass.txt");
34 Map* m2 = new Map("../maps/cozy.txt"); 34 //Map* m2 = new Map("../maps/cozy.txt");
35 35
36 m->setLeftMap(m2); 36 //m->setLeftMap(m2);
37 m2->setRightMap(m); 37 //m2->setRightMap(m);
38 38
39 curGameState = new MapView(m, 100, 100); 39 curGameState = new MapView(m, 100, 100);
40 40
41 Texture* buffer = createTexture(GAME_WIDTH, GAME_HEIGHT); 41 Texture* buffer = createTexture(GAME_WIDTH, GAME_HEIGHT);
42 42
43 double lastTime = glfwGetTime();
44 double accum = 0.0;
45
43 while (!(quit || glfwWindowShouldClose(window))) 46 while (!(quit || glfwWindowShouldClose(window)))
44 { 47 {
45 // Tick! 48 // Tick!
46 curGameState->tick(); 49 accum += (glfwGetTime() - lastTime);
50 if (accum < 0) accum = 0;
51 while (accum > SECONDS_PER_FRAME)
52 {
53 curGameState->tick();
54 accum -= SECONDS_PER_FRAME;
55 }
56
57 lastTime = glfwGetTime();
47 58
48 // Do rendering 59 // Do rendering
49 curGameState->render(buffer); 60 curGameState->render(buffer);