OSDN Git Service

Add GameSurface::Message().
authorDeskull <deskull@users.sourceforge.jp>
Mon, 21 Apr 2014 11:28:45 +0000 (20:28 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Mon, 21 Apr 2014 11:28:45 +0000 (20:28 +0900)
Deeangband/GameSurface.h
Deeangband/GameSurfaceSDL.cpp
Deeangband/GameSurfaceSDL.h

index 045649a..6881b55 100644 (file)
@@ -61,7 +61,7 @@ namespace Deeangband
                virtual void GameSurface::SetFloor(Floor *floorPtr) { floorPtr; }
 
                /*!
-               * @brief \83t\83\8d\83A\95\\8e¦\82Ì\83t\83H\81[\83J\83X\82ð\95Ï\8dX\82·\82é\81B
+               * @brief \83t\83\8d\83A\95\\8e¦\82Ì\83t\83H\81[\83J\83X\82ð\95Ï\8dX\82·\82é
                * @param x \8aî\8f\80X\8dÀ\95W
                * @param y \8aî\8f\80Y\8dÀ\95W
                * @return \82È\82µ
@@ -69,12 +69,18 @@ namespace Deeangband
                virtual void GameSurface::FocusFloor(int x, int y) { x; y; }
 
                /*!
-               * @brief \83t\83\8d\83A\95\\8e¦\82Ì\83t\83H\81[\83J\83X\82ð\95Ï\8dX\82·\82é\81B
+               * @brief \83t\83\8d\83A\95\\8e¦\82Ì\83t\83H\81[\83J\83X\82ð\95Ï\8dX\82·\82é
                * @param coord \8aî\8f\80\8dÀ\95W
                * @return \82È\82µ
                */
                virtual void GameSurface::FocusFloor(Coordinates coord) { coord; }
 
+               /*!
+               * @brief \95W\8f\80\83\81\83b\83Z\81[\83W\82ð\95\\8e¦\82·\82é
+               * @param message \83\81\83b\83Z\81[\83W
+               * @return \82È\82µ
+               */
+               virtual void GameSurface::Message(std::string message) { message; }
 
        };
 
index ab11fe6..5ef23ca 100644 (file)
@@ -324,4 +324,19 @@ namespace Deeangband
                this->focusPoint.Set(coord.GetX(), coord.GetY());
        }
 
+       void GameSurfaceSDL::Message(std::string message)
+       {
+               SDL_Surface *windowSurface = SDL_GetWindowSurface(window);
+               SDL_Surface *messageSurface = SDL_GetWindowSurface(window);
+               SDL_Rect messageRect = {0, 0, 800, 30};
+               SDL_Rect messagePositon = {100, 100, 0, 0}; 
+
+               messageSurface = TTF_RenderUTF8_Blended(font, toUTF8(message.c_str()).c_str(), color);
+
+               SDL_FillRect(messageSurface, &messageRect, SDL_MapRGBA(messageSurface->format, 0, 0, 0, 120));
+
+               SDL_BlitSurface(messageSurface, &messageRect, windowSurface, &messagePositon); 
+               SDL_FreeSurface(messageSurface);
+       }
+
 }
\ No newline at end of file
index b57fe47..5f87d17 100644 (file)
@@ -113,6 +113,13 @@ namespace Deeangband
                */
                void GameSurfaceSDL::FocusFloor(Coordinates coord);
 
+               /*!
+               * @brief \95W\8f\80\83\81\83b\83Z\81[\83W\82ð\95\\8e¦\82·\82é
+               * @param message \83\81\83b\83Z\81[\83W
+               * @return \82È\82µ
+               */
+               void GameSurfaceSDL::Message(std::string message);
+
        };
 
 }
\ No newline at end of file