3 * @brief
\83Q
\81[
\83\80\83G
\83\93\83W
\83\93\82Ì
\8eÀ
\91\95
12 #include "GameEngine.h"
17 GameEngine::GameEngine()
19 gameWorld = new GameWorld();
20 gameSurface = new GameSurfaceSDL(gameWorld);
21 gameSurface->SetFloor(gameWorld->GetFloor(0));
22 gameSurface->SetSideStatusCreature(gameWorld->GetCreature(0));
24 Direction::Initialize();
27 PLAY_EXIT_CODE GameEngine::PlayLoop(void)
29 GAME_COMMAND commandID;
30 PLAY_EXIT_CODE code = PLAY_EXIT_NONE;
31 gameSurface->Redraw();
33 while(code == PLAY_EXIT_NONE)
35 commandID = gameSurface->GetCommand();
36 code = DoGameCommand(commandID);
39 return PLAY_EXIT_QUIT;
42 PLAY_EXIT_CODE GameEngine::DoGameCommand(GAME_COMMAND command)
44 Creature *playerPtr = gameWorld->GetPlayerCreature();
48 case GAME_COMMAND_VIEW_PLAYER_STATUS:
49 gameSurface->ViewCreatureStatus(gameWorld->GetCreature(0));
51 case GAME_COMMAND_REDRAW:
52 gameSurface->Redraw();
54 case GAME_COMMAND_DEBUG_XML_SAVE:
56 gameSurface->Message("XML
\82É
\95Û
\91¶
\82µ
\82Ü
\82µ
\82½
\81B");
58 case GAME_COMMAND_DEBUG_XML_LOAD:
59 gameSurface->Redraw();
61 gameSurface->Message("XML
\82©
\82ç
\8cÄ
\82Ñ
\8fo
\82µ
\82Ü
\82µ
\82½
\81B");
63 case GAME_COMMAND_EXIT:
64 return PLAY_EXIT_QUIT;
66 case GAME_COMMAND_NORTH:
67 playerPtr->Walk(DIRECTION_NORTH);
69 case GAME_COMMAND_NORTH_EAST:
70 playerPtr->Walk(DIRECTION_NORTH_EAST);
72 case GAME_COMMAND_EAST:
73 playerPtr->Walk(DIRECTION_EAST);
75 case GAME_COMMAND_SOUTH_EAST:
76 playerPtr->Walk(DIRECTION_SOUTH_EAST);
78 case GAME_COMMAND_SOUTH:
79 playerPtr->Walk(DIRECTION_SOUTH);
81 case GAME_COMMAND_SOUTH_WEST:
82 playerPtr->Walk(DIRECTION_SOUTH_WEST);
84 case GAME_COMMAND_WEST:
85 playerPtr->Walk(DIRECTION_WEST);
87 case GAME_COMMAND_NORTH_WEST:
88 playerPtr->Walk(DIRECTION_NORTH_WEST);
91 return PLAY_EXIT_NONE;