@@ -24,7 +24,7 @@ float DiceYCoords[2] = {3.f, 142.f};
2424std::pair<std::pair<float , float >, std::pair<float , float >> lDieScreenLoc= make_pair(make_pair(0 .6f , 0 .82f ), make_pair(0 .66f , 0 .88f ));
2525std::pair<std::pair<float , float >, std::pair<float , float >> rDieScreenLoc= make_pair(make_pair(0 .68f , 0 .82f ), make_pair(0 .74f , 0 .88f ));
2626
27- // #define DIE_SIDE_LENGTH 0.06f
27+ // The length of a side of the dice on the sprite sheet in pixels.
2828#define DIE_SCREEN_SIDE_LENGTH 105 .f
2929
3030
@@ -57,26 +57,32 @@ GameView::~GameView() {
5757 */
5858void GameView::drawCardCount (std::string font, int fontSize)
5959{
60+ std::pair<std::pair<float , float >, std::pair<float , float >> roadBuildingRect = getGraphicsConfig ()[" screen.roadBuildingCount.area" ];
61+ std::pair<std::pair<float , float >, std::pair<float , float >> knightRect = getGraphicsConfig ()[" screen.knightCount.area" ];
62+ std::pair<std::pair<float , float >, std::pair<float , float >> yearOfPlentyRect = getGraphicsConfig ()[" screen.yearOfPlentyCount.area" ];
63+ std::pair<std::pair<float , float >, std::pair<float , float >> monopolyRect = getGraphicsConfig ()[" screen.monopolyCount.area" ];
64+ std::pair<std::pair<float , float >, std::pair<float , float >> victoryPointRect = getGraphicsConfig ()[" screen.victoryPointCount.area" ];
65+
6066 if (showTotals==false )
6167 {
62- renderText (font, fontSize, { 0.97 , 0.0 }, { 1.0 , 0.05 } , " ?" ); // Road Building
63- renderText (font, fontSize, { 0.97 , 0.05 }, { 1.0 , 0.1 }, " ?" ); // Knight
64- renderText (font, fontSize, { 0.97 , 0.1 }, { 1.0 , 0.15 } , " ?" ); // Year of Plenty
65- renderText (font, fontSize, { 0.97 , 0.15 }, { 1.0 , 0.2 }, " ?" ); // Monopoly
66- renderText (font, fontSize, { 0.97 , 0.2 }, { 1.0 , 0.25 } , " ?" ); // Victory Point
68+ renderText (font, fontSize, roadBuildingRect. first , roadBuildingRect. second , " ?" ); // Road Building
69+ renderText (font, fontSize, knightRect. first , knightRect. second , " ?" ); // Knight
70+ renderText (font, fontSize, yearOfPlentyRect. first , yearOfPlentyRect. second , " ?" ); // Year of Plenty
71+ renderText (font, fontSize, monopolyRect. first , monopolyRect. second , " ?" ); // Monopoly
72+ renderText (font, fontSize, victoryPointRect. first , victoryPointRect. second , " ?" ); // Victory Point
6773 return ;
6874 }
6975
70- renderText (font, fontSize, { 0.97 , 0.0 }, { 1.0 , 0.05 } ,
71- toString (model.getCurrentPlayer ().getRoadBuildingCards ())); // Road Building
72- renderText (font, fontSize, { 0.97 , 0.05 }, { 1.0 , 0.1 } ,
73- toString (model.getCurrentPlayer ().getKnightCards ())); // Knight
74- renderText (font, fontSize, { 0.97 , 0.1 }, { 1.0 , 0.15 } ,
75- toString (model.getCurrentPlayer ().getYearOfPlentyCards ())); // Year of Plenty
76- renderText (font, fontSize, { 0.97 , 0.15 }, { 1.0 , 0.2 } ,
77- toString (model.getCurrentPlayer ().getMonopolyCards ())); // Monopoly
78- renderText (font, fontSize, { 0.97 , 0.2 }, { 1.0 , 0.25 } ,
79- toString (model.getCurrentPlayer ().getVictoryCards ())); // Victory Point
76+ renderText (font, fontSize, roadBuildingRect. first , roadBuildingRect. second ,
77+ toString (model.getCurrentPlayer ().getRoadBuildingCards ())); // Road Building
78+ renderText (font, fontSize, knightRect. first , knightRect. second ,
79+ toString (model.getCurrentPlayer ().getKnightCards ())); // Knight
80+ renderText (font, fontSize, yearOfPlentyRect. first , yearOfPlentyRect. second ,
81+ toString (model.getCurrentPlayer ().getYearOfPlentyCards ())); // Year of Plenty
82+ renderText (font, fontSize, monopolyRect. first , monopolyRect. second ,
83+ toString (model.getCurrentPlayer ().getMonopolyCards ())); // Monopoly
84+ renderText (font, fontSize, victoryPointRect. first , victoryPointRect. second ,
85+ toString (model.getCurrentPlayer ().getVictoryCards ())); // Victory Point
8086}
8187
8288/* *
@@ -88,25 +94,32 @@ void GameView::drawCardCount(std::string font, int fontSize)
8894 */
8995void GameView::drawResourceCount (std::string font, int fontSize)
9096{
97+
98+ std::pair<std::pair<float , float >, std::pair<float , float >> woodRect = getGraphicsConfig ()[" screen.woodResources.area" ];
99+ std::pair<std::pair<float , float >, std::pair<float , float >> sheepRect = getGraphicsConfig ()[" screen.sheepResources.area" ];
100+ std::pair<std::pair<float , float >, std::pair<float , float >> oreRect = getGraphicsConfig ()[" screen.oreResources.area" ];
101+ std::pair<std::pair<float , float >, std::pair<float , float >> brickRect = getGraphicsConfig ()[" screen.brickResources.area" ];
102+ std::pair<std::pair<float , float >, std::pair<float , float >> wheatRect = getGraphicsConfig ()[" screen.wheatResources.area" ];
103+
91104 if (showTotals==false )
92105 {
93- renderText (font, fontSize, { 0.97 , 0.30 }, { 1.0 , 0.35 } , " ?" ); // Wood
94- renderText (font, fontSize, { 0.97 , 0.35 }, { 1.0 , 0.40 } , " ?" ); // Sheep
95- renderText (font, fontSize, { 0.97 , 0.40 }, { 1.0 , 0.45 }, " ?" ); // Ore
96- renderText (font, fontSize, { 0.97 , 0.45 }, { 1.0 , 0.50 } , " ?" ); // Brick
97- renderText (font, fontSize, { 0.97 , 0.50 }, { 1.0 , 0.55 } , " ?" ); // Wheat
106+ renderText (font, fontSize, woodRect. first , woodRect. second , " ?" ); // Wood
107+ renderText (font, fontSize, sheepRect. first , sheepRect. second , " ?" ); // Sheep
108+ renderText (font, fontSize, oreRect. first , oreRect. second , " ?" ); // Ore
109+ renderText (font, fontSize, brickRect. first , brickRect. second , " ?" ); // Brick
110+ renderText (font, fontSize, wheatRect. first , wheatRect. second , " ?" ); // Wheat
98111 return ;
99112 }
100113
101- renderText (font, fontSize, { 0.97 , 0.30 }, { 1.0 , 0.35 } ,
114+ renderText (font, fontSize, woodRect. first , woodRect. second ,
102115 toString (model.getCurrentPlayer ().getWood ())); // Wood
103- renderText (font, fontSize, { 0.97 , 0.35 }, { 1.0 , 0.40 } ,
116+ renderText (font, fontSize, sheepRect. first , sheepRect. second ,
104117 toString (model.getCurrentPlayer ().getWool ())); // Sheep
105- renderText (font, fontSize, { 0.97 , 0.40 }, { 1.0 , 0.45 } ,
118+ renderText (font, fontSize, oreRect. first , oreRect. second ,
106119 toString (model.getCurrentPlayer ().getOre ())); // Ore
107- renderText (font, fontSize, { 0.97 , 0.45 }, { 1.0 , 0.50 } ,
120+ renderText (font, fontSize, brickRect. first , brickRect. second ,
108121 toString (model.getCurrentPlayer ().getBrick ())); // Brick
109- renderText (font, fontSize, { 0.97 , 0.50 }, { 1.0 , 0.55 } ,
122+ renderText (font, fontSize, wheatRect. first , wheatRect. second ,
110123 toString (model.getCurrentPlayer ().getWheat ())); // Wheat
111124
112125}
0 commit comments