diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-02-15 15:23:19 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-02-15 15:23:19 -0500 |
| commit | 783b308990e7c4ef0837a102a138778f73e4d2b7 (patch) | |
| tree | 77931fcf919f8c8e7996430994c452376aae293f /src/main.cpp | |
| parent | 297c093d398e7d6e5fcc5dc6ba1056ede25abf6f (diff) | |
| download | therapy-783b308990e7c4ef0837a102a138778f73e4d2b7.tar.gz therapy-783b308990e7c4ef0837a102a138778f73e4d2b7.tar.bz2 therapy-783b308990e7c4ef0837a102a138778f73e4d2b7.zip | |
Added bloom!
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 44 |
1 files changed, 1 insertions, 43 deletions
| diff --git a/src/main.cpp b/src/main.cpp index 7c1a21f..e1e1aa2 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -5,26 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | using namespace::std; | 6 | using namespace::std; |
| 7 | 7 | ||
| 8 | #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS__) || defined(__TOS_WIN__) | ||
| 9 | |||
| 10 | #include <windows.h> | ||
| 11 | |||
| 12 | inline void delay( unsigned long ms ) | ||
| 13 | { | ||
| 14 | Sleep( ms ); | ||
| 15 | } | ||
| 16 | |||
| 17 | #else /* presume POSIX */ | ||
| 18 | |||
| 19 | #include <unistd.h> | ||
| 20 | |||
| 21 | inline void delay( unsigned long ms ) | ||
| 22 | { | ||
| 23 | usleep( ms * 1000 ); | ||
| 24 | } | ||
| 25 | |||
| 26 | #endif | ||
| 27 | |||
| 28 | const int FRAMES_PER_SECOND = 60; | 8 | const int FRAMES_PER_SECOND = 60; |
| 29 | bool holding_left = false; | 9 | bool holding_left = false; |
| 30 | bool holding_right = false; | 10 | bool holding_right = false; |
| @@ -81,21 +61,8 @@ int main() | |||
| 81 | 61 | ||
| 82 | Texture* tiles = loadTextureFromBMP("../res/tiles.bmp"); | 62 | Texture* tiles = loadTextureFromBMP("../res/tiles.bmp"); |
| 83 | 63 | ||
| 84 | double lastTime = glfwGetTime(); | ||
| 85 | int nbFrames = 0; | ||
| 86 | |||
| 87 | while (!quit) | 64 | while (!quit) |
| 88 | { | 65 | { |
| 89 | /* | ||
| 90 | double currentTime = glfwGetTime(); | ||
| 91 | nbFrames++; | ||
| 92 | if ( currentTime - lastTime >= 1.0 ){ // If last prinf() was more than 1 sec ago | ||
| 93 | // printf and reset timer | ||
| 94 | printf("%f ms/frame\n", 1000.0/double(nbFrames)); | ||
| 95 | nbFrames = 0; | ||
| 96 | lastTime += 1.0; | ||
| 97 | }*/ | ||
| 98 | |||
| 99 | if (holding_left && player->x_vel >= 0) | 66 | if (holding_left && player->x_vel >= 0) |
| 100 | { | 67 | { |
| 101 | player->x_vel = -2; | 68 | player->x_vel = -2; |
| @@ -125,20 +92,11 @@ int main() | |||
| 125 | Rectangle dst_rect(player->x, player->y, player->w, player->h); | 92 | Rectangle dst_rect(player->x, player->y, player->w, player->h); |
| 126 | 93 | ||
| 127 | //blitTexture(tiles, buffer, &src_rect, &dst_rect); | 94 | //blitTexture(tiles, buffer, &src_rect, &dst_rect); |
| 128 | fillTexture(buffer, &dst_rect, 85, 85, 255); | 95 | fillTexture(buffer, &dst_rect, 255, 255, 255); |
| 129 | //fillTexture(buffer, NULL, 85, 85, 0); | ||
| 130 | 96 | ||
| 131 | renderScreen(buffer); | 97 | renderScreen(buffer); |
| 132 | 98 | ||
| 133 | //fuckThePolice(buffer); | ||
| 134 | |||
| 135 | glfwPollEvents(); | 99 | glfwPollEvents(); |
| 136 | |||
| 137 | // Regulate frame rate | ||
| 138 | /*if ((clock() - frame_start) < CLOCKS_PER_SEC / FRAMES_PER_SECOND) | ||
| 139 | { | ||
| 140 | //delay(((CLOCKS_PER_SEC / FRAMES_PER_SECOND) - clock() + frame_start) * CLOCKS_PER_SEC / 1000); | ||
| 141 | }*/ | ||
| 142 | } | 100 | } |
| 143 | 101 | ||
| 144 | delete map; | 102 | delete map; |
