OSDN Git Service

ステータス描画処理の修正 / Fix drawing status.
authorDeskull <desull@users.sourceforge.jp>
Sun, 11 Jan 2015 07:51:19 +0000 (16:51 +0900)
committerDeskull <desull@users.sourceforge.jp>
Sun, 11 Jan 2015 07:51:19 +0000 (16:51 +0900)
Deeangband/GameSurfaceSDL.cpp

index 1e495e4..29ac1e5 100644 (file)
@@ -135,7 +135,6 @@ namespace Deeangband
        {
                std::map<TAG, boost::shared_ptr<Floor>>::iterator floorIt;
                std::map<TAG, boost::shared_ptr<Species>>::iterator speciesIt;
-               SDL_Rect floorSerfaceRect = {0, 0, squareGraphicWidth, squareGraphicHeight};
                SDL_Surface *surface, *tempSurface, *symbolSurface;
 
                //! @note TTF\83t\83H\83\93\83g\82Ì\93Ç\82Ý\8d\9e\82Ý
@@ -451,10 +450,10 @@ namespace Deeangband
                const int STATUS_BUFSIZE = 100;
                char statusBuf[POS_MAX][STATUS_BUFSIZE];
                SDL_Surface *statusSurface[POS_MAX];
-
+               
                SDL_Rect masterRect = {0, 0, 180, 350};
 
-               surface = SDL_CreateRGBSurface(0, 490, 450, 32, 0, 0, 0, 0);
+               surface = SDL_CreateRGBSurface(0, 180, 350, 32, 0, 0, 0, 0);
 
                sprintf_s(statusBuf[POS_NAME], STATUS_BUFSIZE, "\96¼\91O:%s", creaturePtr->GetName().c_str()); 
                sprintf_s(statusBuf[POS_LEVEL], STATUS_BUFSIZE, "LV:%3d", creaturePtr->GetLevel()); 
@@ -504,7 +503,7 @@ namespace Deeangband
        void GameSurfaceSDL::drawSideCreatureStatus(void)
        {
                SDL_Rect masterRect = {0, 0, 180, 350};
-               SDL_Rect posRect = {10, 120, 190, 470};
+               SDL_Rect posRect = {10, 120, 180, 350};
                SDL_RenderCopy(renderer, creatureSideStatusTexture, &masterRect, &posRect);
        }
 
@@ -714,24 +713,22 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
        {
                SDL_Rect messageRect = {0, 0, 200, 200};
                SDL_Rect messagePositon = {220, 180, 420, 380}; 
-               SDL_Rect windowRect = {210, 170, 420, 220};
+               //SDL_Rect windowRect = {210, 170, 420, 220};
                //SDL_FillRect(windowSurface, &windowRect, SDL_MapRGBA(systemMessageSurface->format, 0, 0, 0, 120));
                SDL_RenderCopy(renderer, systemMessageTexture, &messageRect, &messagePositon);
        }
 
        void GameSurfaceSDL::drawGameMessage(void)
        {
-               SDL_Rect messageRect = {0, 0, 500, 20};
-               SDL_Rect messagePositon = {242, 4, 0, 0}; 
-               SDL_Rect windowRect = {240, 4, 600, 22};
-               //SDL_FillRect(windowSurface, &windowRect, SDL_MapRGBA(gameMessageSurface->format, 0, 0, 0, 120));
+               SDL_Rect messageRect = {0, 0, 512, 20};
+               SDL_Rect messagePositon = {242, 4, 512, 20}; 
                SDL_RenderCopy(renderer, gameMessageTexture, &messageRect, &messagePositon);
        }
 
        void GameSurfaceSDL::drawTimeStatus(void)
        {
                SDL_Rect messageRect = {0, 0, 200, 50};
-               SDL_Rect messagePositon = {10, 480, 0, 0}; 
+               SDL_Rect messagePositon = {10, 480, 210, 530}; 
                SDL_RenderCopy(renderer, gameTimeStatusTexture, &messageRect, &messagePositon);
        }
 
@@ -748,12 +745,16 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
 
        void GameSurfaceSDL::GameMessage(std::string message)
        {
-               SDL_Surface *surface;
+               SDL_Surface *boxSurface, *textSurface;
+               SDL_Rect textPosition = {2, 2, 0, 0}; 
                this->currentGameMessage = message;
                if(gameMessageTexture) SDL_DestroyTexture(gameMessageTexture);
-               surface = TTF_RenderUTF8_Blended(font, toUTF8(this->currentGameMessage.c_str()).c_str(), color);
-               gameMessageTexture = SDL_CreateTextureFromSurface(renderer, surface);
-               SDL_FreeSurface(surface);
+               boxSurface = SDL_CreateRGBSurface(0, 512, 20, 32, 0, 0, 0, 0);
+               textSurface = TTF_RenderUTF8_Blended(font, toUTF8(this->currentGameMessage.c_str()).c_str(), color);
+               SDL_BlitSurface(textSurface, NULL, boxSurface, &textPosition); 
+               gameMessageTexture = SDL_CreateTextureFromSurface(renderer, boxSurface);
+               SDL_FreeSurface(textSurface);
+               SDL_FreeSurface(boxSurface);
        }
 
        void GameSurfaceSDL::updateCreatureGraphics(CREATURE_IT creatureIt)