summary refs log tree commit diff stats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/main.cpp b/src/main.cpp index cbac5bb..cd8ee3e 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -39,13 +39,13 @@ int main(int argc, char** argv)
39 throw sdl_error(); 39 throw sdl_error();
40 } 40 }
41 41
42 Level level; 42 Level level(ren.get());
43 43
44 std::unique_ptr<State> state; 44 std::unique_ptr<State> state;
45 45
46 if (argc == 2 && !strcmp(argv[1], "--editor")) 46 if (argc == 2 && !strcmp(argv[1], "--editor"))
47 { 47 {
48 state.reset(new Editor()); 48 state.reset(new Editor(ren.get()));
49 } else { 49 } else {
50 state.reset(new Simulation(level)); 50 state.reset(new Simulation(level));
51 } 51 }
@@ -63,20 +63,12 @@ int main(int argc, char** argv)
63 63
64 while (SDL_PollEvent(&e)) 64 while (SDL_PollEvent(&e))
65 { 65 {
66 if (e.type == SDL_QUIT) 66 if (e.type == SDL_QUIT ||
67 (e.type == SDL_KEYDOWN &&
68 e.key.keysym.sym == SDLK_ESCAPE))
67 { 69 {
68 quit = true; 70 quit = true;
69 } else if (e.type == SDL_KEYDOWN) 71 break;
70 {
71 switch (e.key.keysym.sym)
72 {
73 case SDLK_ESCAPE:
74 {
75 quit = true;
76
77 break;
78 }
79 }
80 } 72 }
81 } 73 }
82 74