Add DoGameCommand() method to GameWorld class.
@@ -28,6 +28,15 @@ | ||
28 | 28 | #include "Species.h" |
29 | 29 | #include "TrapBase.h" |
30 | 30 | |
31 | +/*! | |
32 | + * ゲームコマンド定義 | |
33 | + */ | |
34 | +enum GameCommand | |
35 | +{ | |
36 | + GAME_COMMAND_REDRAW, | |
37 | + GAME_COMMAND_EXIT | |
38 | +}; | |
39 | + | |
31 | 40 | /*! @class GameWorld |
32 | 41 | * @brief ゲーム世界のクラス |
33 | 42 | */ |
@@ -67,4 +76,8 @@ | ||
67 | 76 | { |
68 | 77 | } |
69 | 78 | |
79 | + /* | |
80 | + * @brief 受け取ったゲームコマンドを処理する | |
81 | + */ | |
82 | + void DoGameCommand(GameCommand command); | |
70 | 83 | }; |
@@ -8,3 +8,14 @@ | ||
8 | 8 | |
9 | 9 | #include "stdafx.h" |
10 | 10 | #include "GameWorld.h" |
11 | + | |
12 | +void GameWorld::DoGameCommand(GameCommand command) | |
13 | +{ | |
14 | + switch(command) | |
15 | + { | |
16 | + case GAME_COMMAND_REDRAW: | |
17 | + break; | |
18 | + case GAME_COMMAND_EXIT: | |
19 | + break; | |
20 | + } | |
21 | +} |
@@ -17,6 +17,15 @@ | ||
17 | 17 | #include <SDL_image.h> |
18 | 18 | #include <SDL_ttf.h> |
19 | 19 | |
20 | +/*! | |
21 | + * @brief SDLのキーコード定義 | |
22 | + */ | |
23 | +enum SDL_KEYCODE_LIST | |
24 | +{ | |
25 | + SDL_KEY_ESC = 27, | |
26 | +}; | |
27 | + | |
28 | + | |
20 | 29 | /*! |
21 | 30 | * @class GameSurfaceSDL |
22 | 31 | * @brief ゲームのメインインターフェイスクラス(SDL実装) |
@@ -70,8 +70,8 @@ | ||
70 | 70 | SDL_Rect src = {0, 0, 300, 200}; |
71 | 71 | SDL_Rect title = {0, 0, 512, 512}; |
72 | 72 | |
73 | - ::setlocale(LC_CTYPE, ""); | |
74 | - ::std::locale::global(std::locale("japanese")); | |
73 | + //::setlocale(LC_CTYPE, ""); | |
74 | + //::std::locale::global(std::locale("japanese")); | |
75 | 75 | |
76 | 76 | renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC); |
77 | 77 |
@@ -112,7 +112,7 @@ | ||
112 | 112 | { |
113 | 113 | key=event.key.keysym.sym; |
114 | 114 | |
115 | - if(key == 27) | |
115 | + if(key == SDL_KEY_ESC) | |
116 | 116 | { |
117 | 117 | return false; |
118 | 118 | } |