OSDN Git Service

Change All Color structure to Color class.
authorDeskull <deskull@users.sourceforge.jp>
Sun, 20 Apr 2014 10:55:16 +0000 (19:55 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Sun, 20 Apr 2014 10:55:16 +0000 (19:55 +0900)
Deeangband/Color.cpp
Deeangband/Color.h
Deeangband/Creature.h
Deeangband/Feature.cpp
Deeangband/Feature.h
Deeangband/GameElement.h
Deeangband/GameSurfaceSDL.cpp

index e04b627..10a7a90 100644 (file)
@@ -51,5 +51,13 @@ namespace Deeangband
        {
                return this->a;
        }
+       
+       void Color::SetColor(int r, int g, int b, int a)
+       {
+               this->r = r;
+               this->g = g;
+               this->b = b;
+               this->a = a;
+       }
 
 }
\ No newline at end of file
index fffad4e..9519810 100644 (file)
@@ -94,5 +94,11 @@ namespace Deeangband
                */
                int Color::GetAlpha(void);
 
+               /*! 
+               * @brief \90F\92l\82ð\83Z\83b\83g\82·\82é
+               * @return \82È\82µ
+               */
+               void Color::SetColor(int r, int g, int b, int a);
+
        };
 }
index 222e340..10dc6d3 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "stdafx.h"
 #include "BaseStatusTable.h"
+#include "Color.h"
 #include "Coordinates.h"
 #include "Discipline.h"
 #include "Effect.h"
@@ -19,7 +20,6 @@
 #include "SavingTable.h"
 #include "Species.h"
 
-
 namespace Deeangband
 {
 
index b31a347..492d085 100644 (file)
@@ -32,14 +32,8 @@ namespace Deeangband
                this->SetID(0);
                this->SetTag("UNKNOWN_FEATURE");
                this->symbol = 'X';
-               this->symColor.r = 40;
-               this->symColor.g = 40;
-               this->symColor.b = 40;
-               this->symColor.a = 255;
-               this->backColor.r = 0;
-               this->backColor.g = 0;
-               this->backColor.b = 0;
-               this->backColor.a = 255;
+               this->symColor.SetColor(40, 40, 40, 255);
+               this->backColor.SetColor(0, 0, 0, 255);
        }
 
        ID Feature::GetTileID(void)
index b460770..2f71263 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "stdafx.h"
 #include "GameElement.h"
+#include "Color.h"
 
 namespace Deeangband
 {
index 6120de3..9f7f20a 100644 (file)
@@ -14,18 +14,6 @@ namespace Deeangband
 {
        class GameWorld;
 
-       /*!
-       * @struct Color
-       * @brief \90F\8ew\92è\82Ì\8d\\91¢\91Ì
-       */
-       typedef struct 
-       {
-               int r; //!<\90Ô
-               int g; //!<\97Î
-               int b; //!<\90Â
-               int a; //!<\83A\83\8b\83t\83@\83`\83\83\83\93\83l\83\8b
-       } Color;
-
        /*! 
        * @class GameElement
        * @brief \83Q\81[\83\80\82Ì\8f\94\97v\91f\82Ì\8aÇ\97\9d\82ð\8ds\82¤\83X\81[\83p\81[\83N\83\89\83X
index 6c77c8d..6e78f7a 100644 (file)
@@ -293,9 +293,9 @@ namespace Deeangband
                                        TAG tag = floorPtr->GetSquare(px, py)->getFeatureTag();
                                        Color symColor = gameWorld->GetFeature(tag)->GetSymColor();
                                        Color backColor = gameWorld->GetFeature(tag)->GetBackColor();
-                                       SDL_Color sdlSymCol = {(Uint8)symColor.r, (Uint8)symColor.g, (Uint8)symColor.b, (Uint8)symColor.a};
+                                       SDL_Color sdlSymCol = {(Uint8)symColor.GetRed(), (Uint8)symColor.GetGreen(), (Uint8)symColor.GetBlue(), (Uint8)symColor.GetAlpha()};
                                        SDL_Rect blitRect = {240 + px * 24, py * 24 , 24, 24};
-                                       SDL_FillRect(windowSurface, &blitRect, SDL_MapRGBA(windowSurface->format, (Uint8)backColor.r, (Uint8)backColor.g, (Uint8)backColor.b, (Uint8)backColor.a));
+                                       SDL_FillRect(windowSurface, &blitRect, SDL_MapRGBA(windowSurface->format, (Uint8)backColor.GetRed(), (Uint8)backColor.GetGreen(), (Uint8)backColor.GetBlue(), (Uint8)backColor.GetAlpha()));
                                        sprintf_s(symBuf, 5, "%c", gameWorld->GetFeature(tag)->GetSymbol()); 
                                        sprintf_s(symBuf, 5, "%c", 'X');