@@ -38,7 +38,7 @@ GameController::GameController(GameBoard& model, GameView& view) : model(model),
3838
3939 view.addElement (makeViewButtonText (std::bind (&GameController::handleCancelButtonEvent, this , _1), {{.92 , .96 }, {1.0 , 1.0 }}, font, fontSize, " Cancel" ));
4040
41- view.addElement (makeViewButtonText (std::bind (&GameController::handleBuyDevelopmentCardButtonEvent, this , _1), {{.85 , .23 }, {1 , .30 }}, font, fontSize, " Development Cards" ));
41+ view.addElement (makeViewButtonText (std::bind (/* &GameController::handleBuyDevelopmentCardButtonEvent*/ &GameController::viewCardTotals , this , _1), {{.85 , .23 }, {1 , .30 }}, font, fontSize, " Development Cards" ));
4242 view.addElement (makeViewButtonText (std::bind (&GameController::handleRoadCardButtonEvent, this , _1), {{0.85 , 0.0 }, {0.97 , 0.05 }}, font, fontSize, " Road Building " ));
4343 view.addElement (makeViewButtonText (std::bind (&GameController::handleKnightCardButtonEvent, this , _1), {{0.85 , 0.05 }, {0.97 , 0.10 }}, font, fontSize, " Knight " ));
4444 view.addElement (makeViewButtonText (std::bind (&GameController::handleYearOfPlentyCardButtonEvent, this , _1), {{0.85 , 0.10 }, {0.97 , 0.15 }}, font, fontSize, " Year of Plenty " ));
@@ -50,6 +50,8 @@ GameController::GameController(GameBoard& model, GameView& view) : model(model),
5050 view.addElement (makeViewButtonText (std::bind (&GameController::handleOreButtonEvent, this , _1), {{.85 , .45 }, {.97 , .50 }}, font, fontSize, " Ore " ));
5151 view.addElement (makeViewButtonText (std::bind (&GameController::handleBrickButtonEvent, this , _1), {{.85 , .50 }, {.97 , .55 }}, font, fontSize, " Brick " ));
5252 view.addElement (makeViewButtonText (std::bind (&GameController::handleWheatButtonEvent, this , _1), {{.85 , .55 }, {.97 , .60 }}, font, fontSize, " Wheat " ));
53+
54+ // view.addElement(makeViewButtonText(std::bind(&GameController::viewCardTotals, this, _1), {{.85, .35}, {.97, .35}}, font, fontSize, "Show Totals"));
5355
5456
5557 stateStack.push_back (BASESTATE);
@@ -145,13 +147,15 @@ void printPlayerInfo(const Player& player) {
145147}
146148
147149/* *
148- * calls a function to advance turn, check for victory and roll dice
150+ * calls a function to advance turn, hide resource and development cards, check for victory, and roll dice
149151 */
150152bool GameController::nextTurn (ScreenCoordinate) {
151153 if (getState () != BASESTATE){
152154 return false ;
153155 }
154-
156+
157+ view.showTotals = false ;
158+
155159 model.endTurn ();
156160 if (model.getDice ().getFirst () + model.getDice ().getSecond () == 7 )
157161 {
@@ -413,6 +417,19 @@ bool GameController::handleVictoryPointCardButtonEvent(ScreenCoordinate coord){
413417 return true ;
414418}
415419
420+ /* *
421+ * Makes the development and resource card totals visible
422+ */
423+ bool GameController::viewCardTotals (ScreenCoordinate coord)
424+ {
425+ auto font = getGraphicsConfig ()[" font.path" ];
426+ auto fontSize = getGraphicsConfig ()[" font.size" ];
427+ view.showTotals = !view.showTotals ;
428+ view.drawCardCount (font, fontSize);
429+ view.drawResourceCount (font, fontSize);
430+ return true ;
431+ }
432+
416433
417434template <int size>
418435auto negativeArr (std::array<int , size> arr) -> std::array<int, size> {
0 commit comments