2 * @file GameSurfaceSDL.h
3 * @brief GameSurfaceSDL
\83N
\83\89\83X
\82Æ
\82»
\82Ì
\91¼
\95t
\90\8f\97v
\91f
\82Ì
\83v
\83\8d\83g
\83^
\83C
\83v
14 #include <SDL_image.h>
15 //#include <SDL_gfx.h>
18 #include "GameSurface.h"
20 BOOST_CLASS_VERSION(GameSurfaceSDL, 1);
26 #define FPS_UPDATE 20 //!< FPS
\8cv
\8eZ
\82ð
\8dX
\90V
\82·
\82é
\83t
\83\8c\81[
\83\80\90\94
27 #define WAIT_MSEC 16 //!<
\83E
\83F
\83C
\83g
\83~
\83\8a\95b(FPS = 1000.0 / WAIT_MSEC)
29 struct SDL_Rect_Dee : public SDL_Rect
31 SDL_Rect_Dee(int x, int y, int w, int h)
39 void SDL_Rect_Dee::Set(int x, int y, int w, int h)
47 SDL_Rect_Dee SDL_Rect_Dee::operator+(const SDL_Rect_Dee& plus)
64 * @class GameSurfaceSDL
65 * @brief
\83Q
\81[
\83\80\82Ì
\83\81\83C
\83\93\83C
\83\93\83^
\81[
\83t
\83F
\83C
\83X
\83N
\83\89\83X(SDL
\8eÀ
\91\95)
67 class GameSurfaceSDL : public GameSurface
71 static const int squareGraphicWidth = 24; //!< 1
\83}
\83X
\82Ì
\83O
\83\89\83t
\83B
\83b
\83N
\95\9d(
\83s
\83N
\83Z
\83\8b)
72 static const int squareGraphicHeight = 24; //!< 1
\83}
\83X
\82Ì
\83O
\83\89\83t
\83B
\83b
\83N
\8d\82\82³(
\83s
\83N
\83Z
\83\8b)
73 static const int fieldPadding = 3; //!<
\8b÷
\95\
\8e¦
\8e\9e\82Ì
\8dÅ
\91å
\8c\84\8aÔ(
\83X
\83N
\83G
\83A)
75 SDL_Rect_Dee rectTitleDst; //!<
\83^
\83C
\83g
\83\8b\83O
\83\89\83t
\83B
\83b
\83N
\93]
\91\97\90æ
\8dÀ
\95W
76 SDL_Rect_Dee rectTitleSrc; //!<
\83^
\83C
\83g
\83\8b\83O
\83\89\83t
\83B
\83b
\83N
\93]
\91\97\8c³
\8dÀ
\95W
78 SDL_Rect_Dee rectFpsDst; //!< FPS
\95\
\8e¦
\93]
\91\97\90æ
\8dÀ
\95W
79 SDL_Rect_Dee rectFpsSrc; //!< FPS
\95\
\8e¦
\93]
\91\97\8c³
\8dÀ
\95W
81 SDL_Rect_Dee rectMainMapDst; //!<
\83\81\83C
\83\93\83}
\83b
\83v
\95\
\8e¦
\93]
\91\97\90æ
83 SDL_Renderer *renderer; //!< SDL
\97p
\83\8c\83\93\83_
\83\89\8eQ
\8fÆ
\83|
\83C
\83\93\83^
84 SDL_Window *window; //!< SDL
\83E
\83B
\83\93\83h
\83E
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
86 Creature *viewCreaturePtr; //!<
\8c»
\8dÝ
\82Ì
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\91Î
\8fÛ
\82Æ
\82È
\82éCreature
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
87 Creature *sideStatusCreatutePtr; //!<
\8c»
\8dÝ
\82Ì
\83X
\83e
\81[
\83^
\83X
\8aÈ
\88Õ
\95\
\8e¦
\91Î
\8fÛ
\82Æ
\82È
\82éCreature
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
88 Field *viewFieldPtr; //!<
\95`
\89æ
\91Î
\8fÛ
\82Æ
\82È
\82éField
\8eQ
\8fÆ
89 Coordinates focusPoint; //!<
\83t
\83\8d\83A
\82Ì
\95`
\89æ
\8d¶
\8fã
\92n
\93_
91 TTF_Font* font; //!<
\95`
\89æ
\95W
\8f\80\83t
\83H
\83\93\83g
\83|
\83C
\83\93\83^
92 TTF_Font* fontSmall; //!<
\95`
\89æ
\8f¬
\8c^
\83t
\83H
\83\93\83g
\83|
\83C
\83\93\83^
93 SDL_Color color; //!<
\83J
\83\89\81[
\95W
\8f\80\83|
\83C
\83\93\83^
96 std::string currentGameMessage; //!<
\8c»
\8dÝ
\95\
\8e¦
\92\86\82Ì
\83Q
\81[
\83\80\83\81\83b
\83Z
\81[
\83Wstring
97 std::string currentSystemMessage; //!<
\8c»
\8dÝ
\95\
\8e¦
\92\86\82Ì
\83V
\83X
\83e
\83\80\83\81\83b
\83Z
\81[
\83Wstring
102 SDL_Surface *windowSurface; //!<
\83Q
\81[
\83\80\83E
\83B
\83\93\83h
\83E
\82ÌSurface
\8eQ
\8fÆ
104 SDL_Texture *titleTexture; //!<
\83Q
\81[
\83\80\83^
\83C
\83g
\83\8b\83O
\83\89\83t
\83B
\83b
\83N
\82ÌTexture
\8eQ
\8fÆ
105 SDL_Texture *unknownFieldTexture; //!<
\96¢
\92m
\83t
\83B
\81[
\83\8b\83h
\83O
\83\89\83t
\83B
\83b
\83N
\82ÌTexture
\8eQ
\8fÆ
106 SDL_Texture *unseenFieldTexture; //!<
\8e\8b\8aE
\8aO
\83t
\83B
\81[
\83\8b\83h
\83O
\83\89\83t
\83B
\83b
\83N
\82ÌTexture
\8eQ
\8fÆ
108 SDL_Texture *systemMessageTexture; //!<
\83V
\83X
\83e
\83\80\83\81\83b
\83Z
\81[
\83W
\83O
\83\89\83t
\83B
\83b
\83N
\82ÌSurface
\8eQ
\8fÆ
109 SDL_Texture *gameMessageTexture; //!<
\83Q
\81[
\83\80\83\81\83b
\83Z
\81[
\83W
\83O
\83\89\83t
\83B
\83b
\83N
\82ÌSurface
\8eQ
\8fÆ
110 SDL_Texture *creatureStatusTexture; //!<
\83N
\83\8a\81[
\83`
\83\83\81[
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\82ÌSurface
\8eQ
\8fÆ
111 SDL_Texture *creatureSideStatusTexture; //!<
\83T
\83C
\83h
\83N
\83\8a\81[
\83`
\83\83\81[
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\82ÌSurface
\8eQ
\8fÆ
112 SDL_Texture *gameTimeStatusTexture; //!<
\83Q
\81[
\83\80\8e\9e\8aÔ
\95\
\8e¦
\82ÌSurface
\8eQ
\8fÆ
113 SDL_Texture *fpsTexture;
116 std::map<TAG, SDL_Texture*> floorTextures; //!<
\83t
\83\8d\83A
\83O
\83\89\83t
\83B
\83b
\83N
\82ÌSurface
\8eQ
\8fÆ
\83\8a\83X
\83g
117 std::map<ID, SDL_Texture*> creatureTextures; //!<
\83N
\83\8a\81[
\83`
\83\83\81[
\83O
\83\89\83t
\83B
\83b
\83N
\82ÌSurface
\8eQ
\8fÆ
\83\8a\83X
\83g
119 void GameSurfaceSDL::pushAnyKey(const CREATURE_IT &subjectCreatureIt);
120 void GameSurfaceSDL::pushAnyKey(void);
127 int frameDeltaTimeLast;
130 * @brief
\83C
\83\93\83^
\81[
\83t
\83F
\83C
\83X
\83f
\81[
\83^
\82Ì
\8f\89\8aú
\89»
131 * @param gameWorld
\83C
\83\93\83^
\81[
\83t
\83F
\83C
\83X
\82ð
\8f\89\8aú
\89»
\82·
\82é
\8dÛ
\82É
\95K
\97v
\82È
\8fî
\95ñ
\82ð
\93¾
\82é
\82½
\82ß
\82ÌGameWorld
\8eQ
\8fÆ
134 void GameSurfaceSDL::initInterfaces(GameWorld *gameWorld);
136 void GameSurfaceSDL::drawCreatureStatus(Creature *creaturePtr);
139 * @brief
\83t
\83\8d\83A
\82ð
\95`
\89æ
\82·
\82é
140 * @param fieldPtr
\95\
\8e¦
\82µ
\82½
\82¢
\83t
\83\8d\83A
\82Ì
\8d\
\91¢
\91Ì
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
141 * @param gameWorld GameWorld
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
142 * @param rectDraw
\95`
\89æ
\88æ
143 * @param x
\8d¶
\8fã
\8bN
\93_
\82ÌX
\8dÀ
\95W
144 * @param y
\8d¶
\8fã
\8bN
\93_
\82ÌY
\8dÀ
\95W
145 * @param w
\95\
\8e¦
\82Ì
\83}
\83X
\95\9d
146 * @param h
\95\
\8e¦
\82Ì
\83}
\83X
\8d\82\82³
149 void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *gameWorld, Field *fieldPtr, SDL_Rect_Dee &rectDraw);
152 * @brief
\83T
\83C
\83h
\83X
\83e
\81[
\83^
\83X
\82ð
\95`
\89æ
\82·
\82é
155 void GameSurfaceSDL::drawSideCreatureStatus(void);
158 * @brief
\83V
\83X
\83e
\83\80\83\81\83b
\83Z
\81[
\83W
\82ð
\95`
\89æ
\82·
\82é
161 void GameSurfaceSDL::drawSystemMessage(void);
164 * @brief
\83Q
\81[
\83\80\83\81\83b
\83Z
\81[
\83W
\82ð
\95`
\89æ
\82·
\82é
167 void GameSurfaceSDL::drawGameMessage(void);
170 * @brief
\83Q
\81[
\83\80\8e\9e\8aÔ
\8fî
\95ñ
\82ð
\95`
\89æ
\82·
\82é
173 void GameSurfaceSDL::drawTimeStatus(void);
175 void GameSurfaceSDL::fpsProcess(void);
181 * @brief
\83Q
\81[
\83\80\89æ
\96Ê
\82ð
\8dÄ
\95`
\89æ
\82·
\82é
182 * @param subjectCreatureIt
\8eå
\8aÏ
\82Æ
\82È
\82é
\83N
\83\8a\81[
\83`
\83\83\81[
\83C
\83e
\83\8c\81[
\83^
185 void GameSurfaceSDL::Draw(const CREATURE_IT& subjectCreatureIt);
188 * @brief
\83Q
\81[
\83\80\8e\9e\8aÔ
\95\
\8e¦
\82ð
\8dX
\90V
\82·
\82é
189 * @param currentTime
\8c»
\8dÝ
\8e\9e\8d\8f
192 void GameSurfaceSDL::UpdateTimeStatus(GAME_TIME currentTime);
195 * @brief
\83T
\83C
\83h
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\82ð
\8dX
\90V
\82·
\82é
196 * @param creaturePtr
\8dX
\90V
\8c³
\83N
\83\8a\81[
\83`
\83\83\81[
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
199 void GameSurfaceSDL::UpdateSideCreatureStatus(Creature *creaturePtr);
203 * @brief
\8ew
\92è
\82³
\82ê
\82½
\83N
\83\8a\81[
\83`
\83\83\81[
\82Ì
\83X
\83e
\81[
\83^
\83X
\82ð
\95\
\8e¦
\82·
\82é
204 * @param creaturePtr
\95\
\8e¦
\82µ
\82½
\82¢
\83N
\83\8a\81[
\83`
\83\83\81[
\82Ì
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
207 void GameSurfaceSDL::ViewCreatureStatus(Creature *creaturePtr);
210 * @brief
\83Q
\81[
\83\80\89æ
\96Ê
\8d¶
\82É
\83v
\83\8c\83C
\83\84\81[
\8aÈ
\97ª
\8fî
\95ñ
\82ð
\95\
\8e¦
\82·
\82é
\81B
211 * @param creaturePtr
\95\
\8e¦
\82µ
\82½
\82¢
\83N
\83\8a\81[
\83`
\83\83\81[
\82Ì
\83C
\83\93\83X
\83^
\83\93\83X
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
\81BNULL
\82È
\82ç
\82Î
\94ñ
\95\
\8e¦
\81B
214 void GameSurfaceSDL::SetSideStatusCreature(Creature *creaturePtr);
217 * @brief
\95\
\8e¦
\82·
\82é
\83t
\83\8d\83A
\82ð
\90Ø
\82è
\91Ö
\82¦
\82é
218 * @param fieldPtr
\95\
\8e¦
\82µ
\82½
\82¢
\83t
\83\8d\83A
\82Ì
\8eQ
\8fÆ
\83|
\83C
\83\93\83^
221 void GameSurfaceSDL::SetField(Field *fieldPtr);
224 * @brief
\83R
\83\93\83X
\83g
\83\89\83N
\83^
225 * @param gameWorld
\8f\88\97\9d\82µ
\82½
\82¢GameWorld
\83C
\83\93\83X
\83^
\83\93\83X
227 GameSurfaceSDL::GameSurfaceSDL(GameWorld *gameWorld);
230 * @brief
\83f
\83X
\83g
\83\89\83N
\83^
232 GameSurfaceSDL::~GameSurfaceSDL(void);
235 * @brief
\83v
\83\8c\83C
\83\84\81[
\82©
\82ç
\83R
\83}
\83\93\83h
\82ð
\8eæ
\93¾
\82·
\82é
236 * @return
\83Q
\81[
\83\80\83R
\83}
\83\93\83hID
238 GAME_COMMAND GameSurfaceSDL::GetCommand(const CREATURE_IT& subjectCreatureIt);
241 * @brief
\83t
\83\8d\83A
\95\
\8e¦
\82Ì
\83t
\83H
\81[
\83J
\83X
\82ð
\95Ï
\8dX
\82·
\82é
242 * @param x
\8aî
\8f\80X
\8dÀ
\95W
243 * @param y
\8aî
\8f\80Y
\8dÀ
\95W
246 void GameSurfaceSDL::FocusField(MAP_LENGTH x, MAP_LENGTH y);
249 * @brief
\83t
\83\8d\83A
\95\
\8e¦
\82Ì
\83t
\83H
\81[
\83J
\83X
\82ð
\95Ï
\8dX
\82·
\82é
250 * @param coord
\8aî
\8f\80\8dÀ
\95W
253 void GameSurfaceSDL::FocusField(Coordinates coord);
256 * @brief
\83V
\83X
\83e
\83\80\83\81\83b
\83Z
\81[
\83W
\82ð
\95\
\8e¦
\82·
\82é
257 * @param message
\83\81\83b
\83Z
\81[
\83W
260 void GameSurfaceSDL::SystemMessage(std::string message);
263 * @brief
\83Q
\81[
\83\80\83\81\83b
\83Z
\81[
\83W
\82ð
\95\
\8e¦
\82·
\82é
264 * @param message
\83\81\83b
\83Z
\81[
\83W
267 void GameSurfaceSDL::GameMessage(std::string message);
270 * @brief
\83N
\83\8a\81[
\83`
\83\83\81[
\97p
\83O
\83\89\83t
\83B
\83b
\83N
\82ð
\90V
\8bK
\8dì
\90¬/
\8dX
\90V
\82·
\82é
271 * @param message
\83\81\83b
\83Z
\81[
\83W
274 void GameSurfaceSDL::updateCreatureGraphics(CREATURE_IT creatureIt);