OSDN Git Service

GameSurfaceSDL::drawField() のリファクタリング / Code refactoring for GameSurfaceSDL::drawField().
authorDeskull <desull@users.sourceforge.jp>
Tue, 13 Jan 2015 13:01:18 +0000 (22:01 +0900)
committerDeskull <desull@users.sourceforge.jp>
Tue, 13 Jan 2015 13:01:18 +0000 (22:01 +0900)
Deeangband/GameSurface.h
Deeangband/GameSurfaceSDL.cpp
Deeangband/GameSurfaceSDL.h

index 929f947..77ab0a8 100644 (file)
@@ -89,7 +89,7 @@ namespace Deeangband
                * @param y \8aî\8f\80Y\8dÀ\95W
                * @return \82È\82µ
                */
-               virtual void GameSurface::FocusField(int x, int y) { x; y; }
+               virtual void GameSurface::FocusField(MAP_LENGTH x, MAP_LENGTH y) { x; y; }
 
                /*!
                 * @brief \83t\83\8d\83A\95\\8e¦\82Ì\83t\83H\81[\83J\83X\82ð\95Ï\8dX\82·\82é
index 814353d..8bdfe89 100644 (file)
@@ -598,14 +598,16 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
 
        MAP_LENGTH px, py;
 
-       int w = rectDraw.w / squareGraphicWidth + 1;
-       int h = rectDraw.h / squareGraphicHeight + 1;
-       int x = focusPoint.GetX() - (w / 2);
-       int y = focusPoint.GetY() - (h / 2);
-       if(x > viewFieldPtr->GetWidth() - w) x = viewFieldPtr->GetWidth();
-       if(y > viewFieldPtr->GetHeight() - h) y = viewFieldPtr->GetHeight();
+       MAP_LENGTH w = rectDraw.w / this->squareGraphicWidth + 1;
+       MAP_LENGTH h = rectDraw.h / this->squareGraphicHeight + 1;
+       MAP_LENGTH x = this->focusPoint.GetX() - (w / 2);
+       MAP_LENGTH y = this->focusPoint.GetY() - (h / 2);
+       /*
+       if(x > this->viewFieldPtr->GetWidth() - w) x = this->viewFieldPtr->GetWidth();
+       if(y > this->viewFieldPtr->GetHeight() - h) y = this->viewFieldPtr->GetHeight();
        if(x < 0) x = 0;
        if(y < 0) y = 0;
+       */
 
        SDL_RenderSetViewport(this->renderer, &rectDraw);
 
@@ -691,7 +693,7 @@ void GameSurfaceSDL::drawField(const CREATURE_IT &subjectCreatureIt, GameWorld *
 
 }
 
-       void GameSurfaceSDL::FocusField(int x, int y)
+       void GameSurfaceSDL::FocusField(MAP_LENGTH x, MAP_LENGTH y)
        {       
                this->focusPoint.Set(x, y);
        }
index 1a5b93b..d34c407 100644 (file)
@@ -242,7 +242,7 @@ namespace Deeangband
                * @param y \8aî\8f\80Y\8dÀ\95W
                * @return \82È\82µ
                */
-               void GameSurfaceSDL::FocusField(int x, int y);
+               void GameSurfaceSDL::FocusField(MAP_LENGTH x, MAP_LENGTH y);
 
                /*!
                * @brief \83t\83\8d\83A\95\\8e¦\82Ì\83t\83H\81[\83J\83X\82ð\95Ï\8dX\82·\82é