diff options
author | tom <tombarrett@siu.edu> | 2017-02-12 06:39:09 -0600 |
---|---|---|
committer | tom <tombarrett@siu.edu> | 2017-02-12 06:39:09 -0600 |
commit | 358ea01c03d787377ef88945706f350befd5b7a9 (patch) | |
tree | f5c830edcc039f95db0c8cc52914735169992ed1 /src | |
parent | aa5c31be6ec6a688e8d3a66c770ba99be8e060c9 (diff) |
-added pause function
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 714845c..82f0067 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,6 +9,7 @@ int main() Timer fps;
int speed = 60;
+ bool pause = false;
while(e.gRun())
{
@@ -23,16 +24,19 @@ int main() case SDLK_q: e.off(); break;
case SDLK_EQUALS: speed+=30; break;
case SDLK_MINUS: if(speed >30) speed-=30; break;
+ case SDLK_SPACE: pause=(pause)?(0):(1); break;
}
}
- main.Clear();
-
- L.Remove();
- L.Behavior();
- L.Place();
+ if(!pause){
+ main.Clear();
+
+ L.Remove();
+ L.Behavior();
+ L.Place();
- main.Render();
+ main.Render();
+ }
if(fps.getTicks() < (1000 / speed))
SDL_Delay((1000 / speed) - fps.getTicks());
|