diff --git a/src/client/panels/MainGamePanelWizard.cpp b/src/client/panels/MainGamePanelWizard.cpp index 1e20c6692509b6437938b4c6e2fd1793b66a9ce7..ced27adb93561778e6142e2354f3ee182f5a82cd 100644 --- a/src/client/panels/MainGamePanelWizard.cpp +++ b/src/client/panels/MainGamePanelWizard.cpp @@ -142,44 +142,63 @@ void MainGamePanelWizard::buildGameState(game_state* gameState, player* me) this->buildOtherPlayers(sizer, gameState, me, myPosition); // show button to display score board - this->buildScoreBoardButton(sizer, gameState); + this->buildScoreLeaveButtons(sizer, gameState); // show button to leave game - this->buildLeaveGameButton(sizer, gameState); + // this->buildLeaveGameButton(sizer, gameState); // update Layout this->Layout(); } -void MainGamePanelWizard::buildScoreBoardButton(wxGridBagSizer *sizer, game_state* gameState) { +void MainGamePanelWizard::buildScoreLeaveButtons(wxGridBagSizer *sizer, game_state* gameState) { wxGBSizerItem* item = sizer->FindItemAtPosition(wxGBPosition(3,3)); wxPanel* panel = dynamic_cast<wxPanel*>(item->GetWindow()); if (gameState->is_started()) { wxBoxSizer *sizer_vert = new wxBoxSizer(wxVERTICAL); panel->SetSizer(sizer_vert); + auto sizer_hor = new wxBoxSizer(wxHORIZONTAL); + sizer_vert->Add(sizer_hor, 1, wxALIGN_LEFT); wxButton *scoreBoardButton = new wxButton(panel, wxID_ANY, "ScoreBoard"); - sizer_vert->Add(scoreBoardButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5); + scoreBoardButton->SetMinSize(wxSize(90, 35)); + sizer_hor->Add(scoreBoardButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 3); + + scoreBoardButton->SetBackgroundColour(wxColour(50,0,51)); // Set background color to blue + scoreBoardButton->SetForegroundColour(*wxWHITE); scoreBoardButton->Bind(wxEVT_BUTTON, [gameState](wxCommandEvent &event) { ScoreBoardDialog scoreBoard(nullptr, "ScoreBoard", "Here will be the scoreboard", gameState); scoreBoard.ShowModal(); }); + + wxButton *leaveGameButton = new wxButton(panel, wxID_ANY, "Leave Game"); + leaveGameButton->SetMinSize(wxSize(90, 35)); + sizer_hor->Add(leaveGameButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 3); + + leaveGameButton->SetBackgroundColour(wxColour(50,0,51)); // Set background color to blue + leaveGameButton->SetForegroundColour(*wxWHITE); + + leaveGameButton->Bind(wxEVT_BUTTON, [gameState](wxCommandEvent &event) { + GameController::leaveGame(); + }); } } +/* void MainGamePanelWizard::buildLeaveGameButton(wxGridBagSizer *sizer, game_state* gameState) { - wxGBSizerItem* item = sizer->FindItemAtPosition(wxGBPosition(3,4)); + wxGBSizerItem* item = sizer->FindItemAtPosition(wxGBPosition(3,3)); wxPanel* panel = dynamic_cast<wxPanel*>(item->GetWindow()); if (gameState->is_started()) { - wxBoxSizer *sizer_vert = new wxBoxSizer(wxVERTICAL); - panel->SetSizer(sizer_vert); + wxSizer* sizer_vert = panel->GetSizer(); + // wxBoxSizer *sizer_vert = new wxBoxSizer(wxVERTICAL); + // panel->SetSizer(sizer_vert); wxButton *leaveGameButton = new wxButton(panel, wxID_ANY, "Leave Game"); - sizer_vert->Add(leaveGameButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5); + sizer_vert->Add(leaveGameButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 1); leaveGameButton->Bind(wxEVT_BUTTON, [gameState](wxCommandEvent &event) { GameController::leaveGame(); @@ -187,7 +206,7 @@ void MainGamePanelWizard::buildLeaveGameButton(wxGridBagSizer *sizer, game_state } } - +*/ void MainGamePanelWizard::buildOtherPlayers(wxGridBagSizer* sizer, game_state* gameState, player* me, int myPosition) { std::vector<player*> players = gameState->get_players(); diff --git a/src/client/panels/MainGamePanelWizard.h b/src/client/panels/MainGamePanelWizard.h index 295011223de2e11153bb2f1e549e9d5a0cf7a34e..01831b07b8e6a3a32e3ab1494ece83e56648b30b 100644 --- a/src/client/panels/MainGamePanelWizard.h +++ b/src/client/panels/MainGamePanelWizard.h @@ -20,8 +20,7 @@ private: void buildTrickPile(wxGridBagSizer* sizer, game_state* gameState, player *me); void buildTrumpCard(wxGridBagSizer* sizer, game_state* gameState); - void buildScoreBoardButton(wxGridBagSizer* sizer, game_state* gameState); - void buildLeaveGameButton(wxGridBagSizer *sizer, game_state* gameState); + void buildScoreLeaveButtons(wxGridBagSizer* sizer, game_state* gameState); wxSize const panelSize = wxSize(960, 680); // also set in the constructor implementation wxSize const cardSize = wxSize(70, 108); diff --git a/src/client/panels/TrickEstimationPanel.cpp b/src/client/panels/TrickEstimationPanel.cpp index 34cb20d7efb8b49a76627b6890181de1cbdfcce0..277d4d2daed8fe8abcebf38795fe823f74fea4fb 100644 --- a/src/client/panels/TrickEstimationPanel.cpp +++ b/src/client/panels/TrickEstimationPanel.cpp @@ -100,27 +100,46 @@ void TrickEstimationPanel::buildGameState(game_state* gameState, player* me) this->buildTrumpColor(sizer, gameState); - this->buildScoreBoardButton(sizer, gameState); + this->buildScoreLeaveButtons(sizer, gameState); this->Layout(); } -void TrickEstimationPanel::buildScoreBoardButton(wxGridBagSizer *sizer, game_state* gameState) { +void TrickEstimationPanel::buildScoreLeaveButtons(wxGridBagSizer *sizer, game_state* gameState) { wxGBSizerItem* item = sizer->FindItemAtPosition(wxGBPosition(2,2)); wxPanel* panel = dynamic_cast<wxPanel*>(item->GetWindow()); wxBoxSizer* sizer_vert = new wxBoxSizer(wxVERTICAL); panel->SetSizer(sizer_vert); + auto sizer_hor = new wxBoxSizer(wxHORIZONTAL); + sizer_vert->Add(sizer_hor, 1, wxALIGN_CENTER); wxButton* scoreBoardButton = new wxButton(panel, wxID_ANY, "ScoreBoard"); - sizer_vert->Add(scoreBoardButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5); + scoreBoardButton->SetMinSize(wxSize(90, 35)); + + scoreBoardButton->SetBackgroundColour(wxColour(50,0,51)); // Set background color to blue + scoreBoardButton->SetForegroundColour(*wxWHITE); + + + sizer_hor->Add(scoreBoardButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 3); scoreBoardButton->Bind(wxEVT_BUTTON, [gameState](wxCommandEvent& event) { ScoreBoardDialog scoreBoard(nullptr, "ScoreBoard", "Here will be the scoreboard", gameState); scoreBoard.ShowModal(); }); + wxButton *leaveGameButton = new wxButton(panel, wxID_ANY, "Leave Game"); + leaveGameButton->SetMinSize(wxSize(90, 35)); + sizer_hor->Add(leaveGameButton, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 3); + + leaveGameButton->SetBackgroundColour(wxColour(50,0,51)); // Set background color to blue + leaveGameButton->SetForegroundColour(*wxWHITE); + + leaveGameButton->Bind(wxEVT_BUTTON, [gameState](wxCommandEvent &event) { + GameController::leaveGame(); + }); + } diff --git a/src/client/panels/TrickEstimationPanel.h b/src/client/panels/TrickEstimationPanel.h index f8d9ef67b3c5cf286c97ca2ffa874360a5a54538..bd42b4f8e16bd403b5febeafc3cd1e3e62b3109c 100644 --- a/src/client/panels/TrickEstimationPanel.h +++ b/src/client/panels/TrickEstimationPanel.h @@ -27,7 +27,7 @@ private: void buildThisPlayer(wxGridBagSizer* sizer, game_state* gameState, player* me); void buildOtherPlayers(wxGridBagSizer* sizer, game_state* gameState, int myPosition); - void buildScoreBoardButton(wxGridBagSizer* sizer, game_state* gameState); + void buildScoreLeaveButtons(wxGridBagSizer* sizer, game_state* gameState); InputField* _trickEstimateField; };