@@ -21,20 +21,45 @@ GameController::GameController(GameBoard& model, GameView& view) : model(model),
2121 auto font = getGraphicsConfig ()[" font.path" ];
2222 auto fontSize = getGraphicsConfig ()[" font.size" ];
2323
24- view.addElement (makeViewButtonText (std::bind (&GameController::handleRoadButtonEvent, this , _1), {{0 , 0 }, {0.1 , 0.10 }}, font, fontSize, " Road |" ));
25- view.addElement (makeViewButtonText (std::bind (&GameController::handleCityButtonEvent, this , _1), {{0.10 , 0.0 }, {0.20 , 0.1 }}, font, fontSize, " City |" ));
26- view.addElement (makeViewButtonText (std::bind (&GameController::handleSettlementButtonEvent, this , _1), {{0.20 , 0.0 }, {0.33 , 0.1 }}, font, fontSize, " Settlement" ));
27- view.addElement (makeViewButtonText (std::bind (&GameController::handleWonderButtonEvent, this , _1), {{0.55 , 0.0 }, {0.65 , 0.1 }}, font, fontSize, " |Wonder" ));
28- view.addElement (makeViewButtonText (std::bind (&GameController::nextTurn, this , _1), {{0 , 0.3 }, {0.1 , 0.4 }}, font, fontSize, " End Turn" ));
24+ view.addElement (makeViewButtonText (
25+ std::bind (&GameController::handleRoadButtonEvent, this , _1),
26+ getGraphicsConfig ()[" screen.roadButton.area" ],
27+ font, fontSize, getGraphicsConfig ()[" screen.roadButton.text" ]));
2928
30- auto playerTopY = 0.82 ;
29+ view.addElement (makeViewButtonText (
30+ std::bind (&GameController::handleCityButtonEvent, this , _1),
31+ getGraphicsConfig ()[" screen.cityButton.area" ],
32+ font, fontSize, getGraphicsConfig ()[" screen.cityButton.text" ]));
33+
34+ view.addElement (makeViewButtonText (
35+ std::bind (&GameController::handleSettlementButtonEvent, this , _1),
36+ getGraphicsConfig ()[" screen.settlementButton.area" ],
37+ font, fontSize, getGraphicsConfig ()[" screen.settlementButton.text" ]));
38+
39+ view.addElement (makeViewButtonText (
40+ std::bind (&GameController::handleWonderButtonEvent, this , _1),
41+ getGraphicsConfig ()[" screen.wonderButton.area" ],
42+ font, fontSize, getGraphicsConfig ()[" screen.wonderButton.text" ]));
43+
44+ view.addElement (makeViewButtonText (
45+ std::bind (&GameController::nextTurn, this , _1),
46+ getGraphicsConfig ()[" screen.endTurnButton.area" ],
47+ font, fontSize, " End Turn" ));
48+
49+ float playerY = getGraphicsConfig ()[" screen.players.topY" ];
3150 for (auto i = 0 ; i < model.getNoOfPlayers (); i++) {
32- auto width = 0.15 ;
51+ float right = getGraphicsConfig ()[" screen.players.right" ];
52+ float width = getGraphicsConfig ()[" screen.players.width" ];
53+ float height = getGraphicsConfig ()[" screen.players.height" ];
3354 Player& player = model.getPlayer (i);
34- view.addElement (makeViewButtonText (std::bind (&GameController::handlePlayerClick, this , _1, std::ref (player)), {{1.0 - width, playerTopY - 0.05 }, {1.0 , playerTopY }}, font, fontSize, player.getName ()));
35- playerTopY -= 0.05 ;
55+ view.addElement (makeViewButtonText (std::bind (&GameController::handlePlayerClick, this , _1, std::ref (player)), {{right - width, playerY - height }, {right, playerY }}, font, fontSize, player.getName ()));
56+ playerY -= height ;
3657 }
37- view.addElement (makeViewButtonText (std::bind (&GameController::handleBankClick, this , _1), {{0 , 0.8 }, {0.1 , 0.9 }}, font, fontSize, " Bank" ));
58+
59+ view.addElement (makeViewButtonText (
60+ std::bind (&GameController::handleBankClick, this , _1),
61+ getGraphicsConfig ()[" screen.bankButton.area" ],
62+ font, fontSize, getGraphicsConfig ()[" screen.bankButton.text" ]));
3863
3964 view.addElement (makeViewButtonText (std::bind (&GameController::handleCancelButtonEvent, this , _1), {{.92 , .96 }, {1.0 , 1.0 }}, font, fontSize, " Cancel" ));
4065
0 commit comments