diff --git a/src/client/GameController.cpp b/src/client/GameController.cpp index 0b066643b2591e0ae0446a3b81e71f80b5d0f9fd..ecb685464b01a90c687186ce48ea0e4b2ed1ad11 100644 --- a/src/client/GameController.cpp +++ b/src/client/GameController.cpp @@ -21,7 +21,6 @@ game_state* GameController::_currentGameState = nullptr; void GameController::init(GameWindow* gameWindow) { - //TODO: panels need to be adapted GameController::_gameWindow = gameWindow; // Set up main panels @@ -137,13 +136,6 @@ void GameController::updateGameState(game_state* newGameState) { showTrickOverMessage(winner); } - if(round_number != oldGameState->get_round_number()) - { - // new round has started - showNewRoundMessage(oldGameState, newGameState); - showStatus("Round " + std::to_string(newGameState->get_round_number() + 1)); - } - // estimation phase if(GameController::_currentGameState->is_estimation_phase()) { GameController::_gameWindow->showPanel(GameController::_trickEstimationPanel); @@ -186,7 +178,6 @@ void GameController::playCard(card* cardToPlay) { ClientNetworkManager::sendRequest(request); } -// TODO: estimate trick request, here message box with entry void GameController::processEstimateTricks() { wxString trickEstimate = GameController::_trickEstimationPanel->getTrickEstimate().Trim(); @@ -255,11 +246,6 @@ void GameController::showNewRoundMessage(game_state* oldGameState, game_state* n message += "\n" + playerName + ": " + scoreText; } - //TODO: what to do with these? Is message just going away or do you have to press okay - //wxMessageDialog dialogBox = wxMessageDialog(nullptr, message, title, wxICON_NONE); - //dialogBox.SetOKLabel(wxMessageDialog::ButtonLabel(buttonLabel)); - //dialogBox.ShowModal(); - auto* dialog = new ScoreDialog(GameController::_gameWindow, title, message); dialog->ShowModal(); diff --git a/src/client/messageBoxes/ErrorDialog.cpp b/src/client/messageBoxes/ErrorDialog.cpp index f2722237adccfa4173ec0ea3c5236bf763bae82d..d97e354725855a3f9d2b993d2fb3bef57ecdef22 100644 --- a/src/client/messageBoxes/ErrorDialog.cpp +++ b/src/client/messageBoxes/ErrorDialog.cpp @@ -7,9 +7,6 @@ ErrorDialog::ErrorDialog(wxWindow* parent, const std::string& title, const std::string& message, const wxBitmap& image) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxSize(400, 250), wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP) { - // Set custom background color (for example, red for error dialogs) - SetBackgroundColour(*wxBLACK); - // Create a vertical sizer for layout wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); @@ -24,7 +21,6 @@ ErrorDialog::ErrorDialog(wxWindow* parent, const std::string& title, const std:: // Display the error message messageCtrl = new wxStaticText(this, wxID_ANY, message); - messageCtrl->SetForegroundColour(*wxWHITE); // Set text color to white for better contrast sizer->Add(messageCtrl, 0, wxALIGN_CENTER | wxALL, 10); // Add an OK button to close the dialog @@ -32,5 +28,4 @@ ErrorDialog::ErrorDialog(wxWindow* parent, const std::string& title, const std:: sizer->Add(okButton, 0, wxALIGN_CENTER | wxALL, 10); SetSizerAndFit(sizer); - Centre(); // Center the dialog on the screen } \ No newline at end of file diff --git a/src/client/messageBoxes/ScoreBoardDialog.cpp b/src/client/messageBoxes/ScoreBoardDialog.cpp index 9d660e0da2370a87a4e79e893ba327de42b6d3ad..6f1d84946ce910e08755135532a481b19e24df89 100644 --- a/src/client/messageBoxes/ScoreBoardDialog.cpp +++ b/src/client/messageBoxes/ScoreBoardDialog.cpp @@ -52,7 +52,6 @@ ScoreBoardDialog::ScoreBoardDialog(wxWindow* parent, const std::string& title, c if (numRows >= 1) { for (int i = 0; i < numberOfPlayers; i++) { auto scores = players.at(i)->get_scores(); - //tableData[i] = scores; tableData[i].insert( tableData[i].end(), // Insert starting at the end of tableData[i] scores.begin()+1, // Start of scores diff --git a/src/client/messageBoxes/ScoreBoardDialog.h b/src/client/messageBoxes/ScoreBoardDialog.h index 1c75aacdd5ad3f4e5506e475af67775ad0250a91..65cb1d647c01f7e24f21c1fdfa3919a0a847a415 100644 --- a/src/client/messageBoxes/ScoreBoardDialog.h +++ b/src/client/messageBoxes/ScoreBoardDialog.h @@ -6,8 +6,6 @@ #define WIZARD_SCOREBOARDDIALOG_H #include <wx/wx.h> -#include <wx/statbmp.h> -#include<vector> #include "../../common/game_state/game_state.h" class ScoreBoardDialog: public wxDialog { diff --git a/src/client/messageBoxes/ScoreDialog.cpp b/src/client/messageBoxes/ScoreDialog.cpp index c7b706c2c801df54b3e0d4496889159f6c788232..2a844b410fd7fa72a129ce2cfb4650f464bf64d0 100644 --- a/src/client/messageBoxes/ScoreDialog.cpp +++ b/src/client/messageBoxes/ScoreDialog.cpp @@ -18,7 +18,7 @@ ScoreDialog::ScoreDialog(wxWindow* parent, const std::string& title, const std:: sizer->Add(messageText, 1, wxALL | wxEXPAND, 10); SetSizerAndFit(sizer); - // Initialize the timer to close the dialog after 5 seconds + // Initialize the timer to close the dialog after 2 seconds _closeTimer.SetOwner(this, wxID_ANY); _closeTimer.Start(2000, wxTIMER_ONE_SHOT); // 5 seconds } diff --git a/src/client/panels/MainGamePanelWizard.cpp b/src/client/panels/MainGamePanelWizard.cpp index dd8d54754dd558793ce683ec3cfa4a64167d06dd..85fd8516c307de57c7611e6146c91423dedcc1da 100644 --- a/src/client/panels/MainGamePanelWizard.cpp +++ b/src/client/panels/MainGamePanelWizard.cpp @@ -34,34 +34,6 @@ void MainGamePanelWizard::buildGameState(game_state* gameState, player* me) wxPanel *panel = new wxPanel(this, wxID_ANY); this->SetBackgroundColour(wxColour(102,0,51)); - /* - // access the main window to add a button - wxFrame* parentFrame = dynamic_cast<wxFrame*>(this->GetParent()); - if (parentFrame && parentFrame->GetStatusBar()) { - wxStatusBar *statusBar = parentFrame->GetStatusBar(); - - // Retrieve the existing sizer - wxSizer *statusSizer = statusBar->GetSizer(); - if (statusSizer) { - wxButton* scoreBoardButton = new wxButton(statusBar, wxID_ANY, "ScoreBoard"); - statusSizer->Add(scoreBoardButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); - // Refresh the layout - statusBar->Layout(); - } - } - - // put all player scores in a vector - std::vector<player*> players = gameState->get_players(); - int numberOfPlayers = players.size(); - std::vector<std::vector<int>> tableData(numberOfPlayers); - - for (int i = 0; i < numberOfPlayers; i++){ - tableData.at(i) = players.at(i)->get_scores(); - } - */ - - - this->SetMinSize(wxSize(1200, 850)); //create Grid to partition game panel @@ -84,10 +56,6 @@ void MainGamePanelWizard::buildGameState(game_state* gameState, player* me) {{4,0}, {1,5}} }; - // set gaps between the panels to 0 explicitly - //sizer->SetVGap(0); - //sizer->SetHGap(0); - // Add other players std::vector<player*> players = gameState->get_players(); int numberOfPlayers = players.size(); @@ -176,29 +144,12 @@ void MainGamePanelWizard::buildRoundDisplay(wxGridBagSizer* sizer, game_state* g { wxGBSizerItem* roundItem; - /* - //in top left corner for 3 players - if (gameState->get_players().size() == 3) - { - roundItem = sizer->FindItemAtPosition(wxGBPosition(0,0)); - } - //in bottom left corner if 4-6 players - else - { - */ roundItem = sizer->FindItemAtPosition(wxGBPosition(0,0)); // } wxPanel* roundPanel = dynamic_cast<wxPanel*>(roundItem->GetWindow()); wxBoxSizer* roundSizer_vert = new wxBoxSizer(wxVERTICAL); roundPanel->SetSizer(roundSizer_vert); - /* - if (!roundPanel->GetSizer()) { - auto* roundSizer_vert = new wxBoxSizer(wxVERTICAL); - roundPanel->SetSizer(roundSizer_vert); - roundPanel->SetMinSize(wxSize(200, 60)); // Lock minimum size - } - */ if(gameState->is_started()) { // roundPanel->GetSizer()->Clear(true); //clear existing content to avoid stacking @@ -212,9 +163,6 @@ void MainGamePanelWizard::buildRoundDisplay(wxGridBagSizer* sizer, game_state* g estimateText->SetFont(regularFont); roundPanel->GetSizer()->Add(estimateText, 0, wxALIGN_CENTER | wxALL, 5); } - //roundPanel->Layout(); - //roundPanel->Refresh(); - } @@ -256,26 +204,6 @@ void MainGamePanelWizard::buildScoreLeaveButtons(wxGridBagSizer *sizer, game_sta }); } -/* -void MainGamePanelWizard::buildLeaveGameButton(wxGridBagSizer *sizer, game_state* gameState) { - wxGBSizerItem* item = sizer->FindItemAtPosition(wxGBPosition(3,3)); - wxPanel* panel = dynamic_cast<wxPanel*>(item->GetWindow()); - - if (gameState->is_started()) { - 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, 1); - - leaveGameButton->Bind(wxEVT_BUTTON, [gameState](wxCommandEvent &event) { - GameController::leaveGame(); - }); - } - -} -*/ void MainGamePanelWizard::buildOtherPlayers(wxGridBagSizer* sizer, game_state* gameState, player* me, int myPosition) { std::vector<player*> players = gameState->get_players(); @@ -292,15 +220,15 @@ void MainGamePanelWizard::buildOtherPlayers(wxGridBagSizer* sizer, game_state* g } else if (numberOfPlayers == 4) { - otherPlayerPositions = { wxGBPosition(0, 2), wxGBPosition(1, 0), wxGBPosition(1, 4)}; + otherPlayerPositions = { wxGBPosition(1, 0), wxGBPosition(0, 2), wxGBPosition(1, 4)}; } else if (numberOfPlayers == 5) { - otherPlayerPositions = { wxGBPosition(0, 1), wxGBPosition(0, 3), wxGBPosition(1, 0), wxGBPosition(1, 4)}; + otherPlayerPositions = { wxGBPosition(1, 0), wxGBPosition(0, 1), wxGBPosition(0, 3), wxGBPosition(1, 4)}; } else if (numberOfPlayers == 6) { - otherPlayerPositions = { wxGBPosition(0, 1), wxGBPosition(0, 2), wxGBPosition(0, 3), wxGBPosition(1, 0), wxGBPosition(1, 4)}; + otherPlayerPositions = { wxGBPosition(1, 0), wxGBPosition(0, 1), wxGBPosition(0, 2), wxGBPosition(0, 3), wxGBPosition(1, 4)}; } for (int i = 0; i < otherPlayerPositions.size(); i++) @@ -310,8 +238,6 @@ void MainGamePanelWizard::buildOtherPlayers(wxGridBagSizer* sizer, game_state* g wxPanel* panel = dynamic_cast<wxPanel*>(item->GetWindow()); wxBoxSizer* playerSizer_vert = new wxBoxSizer(wxVERTICAL); panel->SetSizer(playerSizer_vert); - // TODO: look at this - panel->SetMinSize(wxSize(150,25)); panel->SetBackgroundColour(wxColour(120,0,51)); // get other player @@ -320,12 +246,12 @@ void MainGamePanelWizard::buildOtherPlayers(wxGridBagSizer* sizer, game_state* g // Lobby: display names if(!gameState->is_started()) { - wxStaticText* playerNameText = new wxStaticText(panel, wxID_ANY, otherPlayer->get_player_name(),wxDefaultPosition, wxSize(150, 35), wxALIGN_CENTER); + wxStaticText* playerNameText = new wxStaticText(panel, wxID_ANY, otherPlayer->get_player_name(),wxDefaultPosition, wxSize(panel->GetMinSize().GetWidth(), 35), wxALIGN_CENTER); playerNameText->SetForegroundColour(*wxWHITE); playerNameText->SetFont(regularFontBig); - wxStaticText* statusText = new wxStaticText(panel, wxID_ANY, "waiting...",wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER); + wxStaticText* statusText = new wxStaticText(panel, wxID_ANY, "waiting...",wxDefaultPosition, wxSize(panel->GetMinSize().GetWidth(), 35), wxALIGN_CENTER); statusText->SetForegroundColour(*wxWHITE); statusText->SetFont(regularFont); playerSizer_vert->Add(playerNameText,0,wxALIGN_CENTER|wxTOP, 5); @@ -344,6 +270,17 @@ void MainGamePanelWizard::buildOtherPlayers(wxGridBagSizer* sizer, game_state* g trickText->SetFont(regularFont); playerSizer_vert->Add(playerNameText,0,wxALIGN_CENTER|wxTOP,5); playerSizer_vert->Add(trickText,0,wxALIGN_CENTER); + if (otherPlayer == gameState->get_current_player()) + { + panel->SetBackgroundColour(wxColour(50,0,51)); + } + if (otherPlayer == gameState->get_starting_player()) + { + wxStaticText* startText = new wxStaticText(panel, wxID_ANY, "Starting Player",wxDefaultPosition, wxSize(150, 35), wxALIGN_CENTER); + startText->SetForegroundColour(*wxWHITE); + startText->SetFont(regularFont); + playerSizer_vert->Add(startText,0,wxALIGN_CENTER); + } } } @@ -358,7 +295,7 @@ void MainGamePanelWizard::buildTrumpCard(wxGridBagSizer* sizer, game_state* game if(gameState->is_started()) { - wxStaticText* trumpText = new wxStaticText(trumpPanel, wxID_ANY, "TRUMP CARD",wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER); + wxStaticText* trumpText = new wxStaticText(trumpPanel, wxID_ANY, "TRUMP CARD",wxDefaultPosition, wxSize(trumpPanel->GetMinSize().GetWidth(),35), wxALIGN_CENTER); trumpText->SetForegroundColour(*wxWHITE); trumpText->SetFont(regularFont); int trumpColor = gameState->get_trump_color(); @@ -400,7 +337,7 @@ void MainGamePanelWizard::buildTrickPile(wxGridBagSizer* sizer, game_state* game else{ std::string wizardLogoImage = "assets/Wizard_round.png"; ImagePanel* wizardLogo = new ImagePanel(trickPanel, wizardLogoImage, wxBITMAP_TYPE_ANY, wxDefaultPosition, wxSize(130,116)); - trickPanelSizer_hor->Add(wizardLogo, 0, wxALIGN_CENTER ); + trickPanelSizer_hor->Add(wizardLogo, 0, wxALIGN_BOTTOM); } } @@ -446,9 +383,6 @@ void MainGamePanelWizard::buildThisPlayer(wxGridBagSizer* sizer, game_state* gam wxGBSizerItem* meItem = sizer->FindItemAtPosition(wxGBPosition(3,2)); wxPanel* mePanel = dynamic_cast<wxPanel*>(meItem->GetWindow()); mePanel->SetBackgroundColour(wxColour(120,0,51)); - //TODO: anschauen - mePanel->SetMinSize(wxSize(290,25)); - // create sizer to align elements at bottom center wxBoxSizer* meSizer_hor = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* meSizer = new wxBoxSizer(wxVERTICAL); meSizer_hor->Add(meSizer, 1, wxALIGN_BOTTOM); @@ -491,6 +425,10 @@ void MainGamePanelWizard::buildThisPlayer(wxGridBagSizer* sizer, game_state* gam } else { + if (me == gameState->get_current_player()) + { + mePanel->SetBackgroundColour(wxColour(50,0,51)); + } // show estimated and scored tricks instead of status text wxStaticText* playerScore = new wxStaticText(mePanel, wxID_ANY, std::to_string(me->get_nof_tricks()) + "/" + std::to_string(me->get_nof_predicted()) + " Tricks",wxDefaultPosition, wxSize(100, 20), wxALIGN_CENTER); playerScore->SetForegroundColour(*wxWHITE); @@ -506,7 +444,7 @@ void MainGamePanelWizard::buildThisPlayer(wxGridBagSizer* sizer, game_state* gam wxGBSizerItem* cardItem = sizer->FindItemAtPosition(wxGBPosition(4,0)); wxPanel* cardPanel = dynamic_cast<wxPanel*>(cardItem->GetWindow()); - wxSize scaledCardSize = MainGamePanelWizard::cardSize; + wxSize scaledCardSize = wxSize(MainGamePanelWizard::cardSize.GetWidth()*0.9, MainGamePanelWizard::cardSize.GetHeight()*0.9); // define two new sizers to be able to center the cards auto cardPanelSizer_vert = new wxBoxSizer(wxVERTICAL); @@ -554,7 +492,7 @@ void MainGamePanelWizard::buildThisPlayer(wxGridBagSizer* sizer, game_state* gam GameController::playCard(handCard); }); } - cardPanelSizer_hor->Add(cardButton, 0, wxALIGN_TOP | wxRIGHT | wxLEFT, 4); + cardPanelSizer_hor->Add(cardButton, 0, wxALIGN_CENTER | wxRIGHT | wxLEFT, 4); } } diff --git a/src/client/panels/TrickEstimationPanel.cpp b/src/client/panels/TrickEstimationPanel.cpp index 6ec122cedc0fb04021ec7e43ad941faae84e2895..fab28ec9504618262cc17813f03a22df59d89346 100644 --- a/src/client/panels/TrickEstimationPanel.cpp +++ b/src/client/panels/TrickEstimationPanel.cpp @@ -8,7 +8,10 @@ wxFont regularFontTrick = wxFont(wxFontInfo(12).FaceName("Junicode")); wxFont regularFontTrickBig = wxFont(wxFontInfo(18).FaceName("Junicode")); TrickEstimationPanel::TrickEstimationPanel(wxWindow* parent): wxPanel(parent, wxID_ANY, wxDefaultPosition, - wxSize(1200, 850)){} + wxSize(1200, 850)) +{ + this->SetMinSize(wxSize(1200, 850)); +} TrickEstimationPanel::~TrickEstimationPanel() { delete _trickEstimateField; @@ -61,8 +64,8 @@ void TrickEstimationPanel::buildGameState(game_state* gameState, player* me) // specify minimum size of the panels - int minWidth = TrickEstimationPanel::panelSize.GetWidth()/3; - int minHeight = TrickEstimationPanel::panelSize.GetHeight()/4; + int minWidth = TrickEstimationPanel::panelSize.GetWidth()/3-30; + int minHeight = TrickEstimationPanel::panelSize.GetHeight()/4-30; // fill the gridsizer with panels and set the minimum size accordingly for (auto &item : items) @@ -70,7 +73,7 @@ void TrickEstimationPanel::buildGameState(game_state* gameState, player* me) auto p = new wxPanel(panel, wxID_ANY, wxDefaultPosition); p->SetMinSize(wxSize(minWidth,minHeight)); p->SetBackgroundColour(wxColour(102,0,51)); - sizer->Add(p, item.first, item.second, wxEXPAND|wxALL,5); + sizer->Add(p, item.first, item.second, wxEXPAND|wxALL,1); } @@ -152,7 +155,7 @@ void TrickEstimationPanel::buildTrumpColor(wxGridBagSizer *sizer, game_state *ga wxBoxSizer* trumpSizer_vert = new wxBoxSizer(wxVERTICAL); trumpPanel->SetSizer(trumpSizer_vert); - wxStaticText* trumpText = new wxStaticText(trumpPanel, wxID_ANY, "TRUMP CARD",wxDefaultPosition, wxSize(120, 20), wxALIGN_CENTER); + wxStaticText* trumpText = new wxStaticText(trumpPanel, wxID_ANY, "TRUMP CARD",wxDefaultPosition, wxSize(trumpPanel->GetMinSize().GetWidth(), 20), wxALIGN_CENTER); trumpText->SetForegroundColour(*wxWHITE); trumpText->SetFont(regularFontTrick); @@ -190,6 +193,7 @@ void TrickEstimationPanel::buildHand(wxGridBagSizer *sizer, game_state *gameStat scaledCardSize = wxSize(scaledCardWidth, scaledCardHeight); } + // Show all cards for (int i = 0; i < me->get_hand()->get_cards().size(); i++) { @@ -228,7 +232,7 @@ void TrickEstimationPanel::buildCenter(wxGridBagSizer* sizer, game_state* gameSt centerPanelSizer_hor->Add(centerPanelSizer_vert2, 1, wxALIGN_CENTER); // add round number - wxStaticText* roundNumber = new wxStaticText(centerPanel, wxID_ANY, "Round " + std::to_string(gameState->get_round_number()+1),wxDefaultPosition, wxSize(80, 43), wxALIGN_CENTER); + wxStaticText* roundNumber = new wxStaticText(centerPanel, wxID_ANY, "Round " + std::to_string(gameState->get_round_number()+1),wxDefaultPosition, wxSize(centerPanel->GetMinSize().GetWidth(), 43), wxALIGN_CENTER); roundNumber->SetForegroundColour(*wxWHITE); roundNumber->SetFont(magicalFontTrick); @@ -255,7 +259,7 @@ void TrickEstimationPanel::buildThisPlayer(wxGridBagSizer* sizer, game_state* ga playerName->SetForegroundColour(*wxWHITE); playerName->SetFont(regularFontTrickBig); - mePanelSizer_vert->Add(playerName, 0, wxALIGN_CENTER); + mePanelSizer_vert->Add(playerName, 0, wxALIGN_CENTER|wxTOP, 5); // if we have not submitted estimate yet if (me->get_nof_predicted() == -1) @@ -265,7 +269,7 @@ void TrickEstimationPanel::buildThisPlayer(wxGridBagSizer* sizer, game_state* ga mePanel->SetBackgroundColour(wxColour(50,0,51)); // add input field for trick estimate - wxStaticText* inputLabel = new wxStaticText(mePanel, wxID_ANY, "Trick estimate:",wxDefaultPosition, wxSize(130, 20), wxALIGN_CENTER); + wxStaticText* inputLabel = new wxStaticText(mePanel, wxID_ANY, "Trick estimate:",wxDefaultPosition, wxSize(mePanel->GetMinSize().GetWidth(), 20), wxALIGN_CENTER); inputLabel->SetForegroundColour(*wxWHITE); inputLabel->SetFont(regularFontTrick); mePanelSizer_vert->Add(inputLabel, 0, wxALIGN_CENTER); @@ -289,7 +293,7 @@ void TrickEstimationPanel::buildThisPlayer(wxGridBagSizer* sizer, game_state* ga } else { - wxStaticText* playerName = new wxStaticText(mePanel, wxID_ANY, "waiting...",wxDefaultPosition, wxSize(110, 20), wxALIGN_CENTER); + wxStaticText* playerName = new wxStaticText(mePanel, wxID_ANY, "waiting...",wxDefaultPosition, wxSize(mePanel->GetMinSize().GetWidth(), 20), wxALIGN_CENTER); //large enough for a 15 character name playerName->SetForegroundColour(*wxWHITE); playerName->SetFont(regularFontTrick); @@ -301,12 +305,11 @@ void TrickEstimationPanel::buildThisPlayer(wxGridBagSizer* sizer, game_state* ga else { // display the number of tricks - wxStaticText* estimatedTricks = new wxStaticText(mePanel, wxID_ANY, std::to_string(me->get_nof_predicted()) + " Tricks",wxDefaultPosition, wxSize(110, 20), wxALIGN_CENTER); + wxStaticText* estimatedTricks = new wxStaticText(mePanel, wxID_ANY, std::to_string(me->get_nof_predicted()) + " Tricks",wxDefaultPosition, wxSize(mePanel->GetMinSize().GetWidth(), 20), wxALIGN_CENTER); estimatedTricks->SetForegroundColour(*wxWHITE); estimatedTricks->SetFont(regularFontTrick); mePanelSizer_vert->Add(estimatedTricks, 0, wxALIGN_CENTER); } - // mePanel->SetSizer(mePanelSizer_hor); } void TrickEstimationPanel::buildOtherPlayers(wxGridBagSizer* sizer, game_state* gameState, int myPosition) @@ -367,14 +370,14 @@ void TrickEstimationPanel::buildOtherPlayers(wxGridBagSizer* sizer, game_state* statusText = "waiting..."; } - wxStaticText* playerNameText = new wxStaticText(panel, wxID_ANY, statusText,wxDefaultPosition, wxSize(150, 30), wxALIGN_CENTER); + wxStaticText* playerNameText = new wxStaticText(panel, wxID_ANY, statusText,wxDefaultPosition, wxSize(panel->GetMinSize().GetWidth(), 30), wxALIGN_CENTER); playerNameText->SetForegroundColour(*wxWHITE); playerNameText->SetFont(regularFontTrick); playerSizer_vert->Add(playerNameText, 0, wxALIGN_CENTER); } else { - wxStaticText* playerNameText = new wxStaticText(panel, wxID_ANY, std::to_string(otherPlayer->get_nof_predicted()) + " Tricks",wxDefaultPosition, wxSize(80, 20), wxALIGN_CENTER); + wxStaticText* playerNameText = new wxStaticText(panel, wxID_ANY, std::to_string(otherPlayer->get_nof_predicted()) + " Tricks",wxDefaultPosition, wxSize(panel->GetMinSize().GetWidth(), 20), wxALIGN_CENTER); //8 characters, width 80 playerNameText->SetForegroundColour(*wxWHITE); playerNameText->SetFont(regularFontTrick); diff --git a/src/client/panels/TrickEstimationPanel.h b/src/client/panels/TrickEstimationPanel.h index 57d64952ecb71e859b20586e9f577417f22f6216..635e75c4109915a3d940c78093c6c896a5d4ef68 100644 --- a/src/client/panels/TrickEstimationPanel.h +++ b/src/client/panels/TrickEstimationPanel.h @@ -18,7 +18,7 @@ public: wxString getTrickEstimate(); void buildGameState(game_state* gameState, player* me); private: - wxSize const panelSize = wxSize(960, 680); + wxSize const panelSize = wxSize(1200, 850); wxSize const cardSize = wxSize(85, 131); void buildCenter(wxGridBagSizer* sizer, game_state* gameState); diff --git a/src/client/uiElements/InputField.cpp b/src/client/uiElements/InputField.cpp index 50ece90e32fb961a4b8667829072e5db2f49c2c7..720b0db19c084896a386b3a335c6abccdc4f209f 100644 --- a/src/client/uiElements/InputField.cpp +++ b/src/client/uiElements/InputField.cpp @@ -11,7 +11,7 @@ InputField::InputField(wxWindow* parent, const wxString& labelText, int labelWid wxID_ANY, // element id labelText, // text that's displayed as label wxDefaultPosition, // position - wxSize(labelWidth, -1) // size (-1 means default size) + wxSize(labelWidth, 40) ); horizontalLayout->Add(this->_label, 0, wxALIGN_CENTER); @@ -20,7 +20,7 @@ InputField::InputField(wxWindow* parent, const wxString& labelText, int labelWid wxID_ANY, // element id fieldValue, // default value wxDefaultPosition, // position - wxSize(fieldWidth, -1) // size (-1 means default size) + wxSize(fieldWidth, 40) ); horizontalLayout->Add(this->_field, 0, wxALIGN_CENTER); diff --git a/src/client/windows/GameWindow.cpp b/src/client/windows/GameWindow.cpp index ee1712d9d6ec689ae10ad2592adc7439d53349b5..1222a3f107a9fb67e89be55b1c1d571fd8be79d2 100644 --- a/src/client/windows/GameWindow.cpp +++ b/src/client/windows/GameWindow.cpp @@ -15,7 +15,7 @@ GameWindow::GameWindow(const wxString& title, const wxPoint& pos, const wxSize& // Add "Rules" button directly to the status bar _rulesButton = new wxButton(_statusBar, wxID_ANY, "Rules"); - _settingsButton = new wxButton(_statusBar, wxID_ANY, "Settings"); + //_settingsButton = new wxButton(_statusBar, wxID_ANY, "Settings"); // Set minimum height of status bar based on the button's height with padding _statusBar->SetMinHeight(_rulesButton->GetSize().GetHeight() + 10); @@ -26,21 +26,19 @@ GameWindow::GameWindow(const wxString& title, const wxPoint& pos, const wxSize& // Add stretchable space to fill space in statusbar statusSizer->AddStretchSpacer(1); - statusSizer->Add(_settingsButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + //statusSizer->Add(_settingsButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); statusSizer->Add(_rulesButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); _statusBar->SetSizer(statusSizer); _statusBar->Layout(); // Bind the button click event to showRules method _rulesButton->Bind(wxEVT_BUTTON, &GameWindow::showRules, this); - _settingsButton->Bind(wxEVT_BUTTON, &GameWindow::show_settings, this); // Set background wxColor lightBlue = wxColor(102, 0, 51); this->SetBackgroundColour(lightBlue); - // Set the minimum size of the window. The user won't be able to resize the window to a size smaller than this - this->SetMinSize(wxSize(1000, 720)); + this->SetMinSize(wxSize(1200, 850)); } @@ -87,10 +85,3 @@ void GameWindow::showRules(wxCommandEvent& event) { wxMessageBox("Die Datei 'Rules.pdf' wurde nicht gefunden!", "Fehler", wxICON_ERROR); } } - -void GameWindow::show_settings(wxCommandEvent& event){ - wxString settings = "Not implemented yet"; - - wxMessageDialog rulesDialog(this, settings, "Game Rules", wxOK | wxICON_INFORMATION); - rulesDialog.ShowModal(); -} diff --git a/src/client/windows/GameWindow.h b/src/client/windows/GameWindow.h index b02b19d19760f2703d4cf42999e102cd548aab9b..53946eeaae30397bb185ab87018286db069148fb 100644 --- a/src/client/windows/GameWindow.h +++ b/src/client/windows/GameWindow.h @@ -21,7 +21,6 @@ private: wxPanel* _currentPanel; void showRules(wxCommandEvent& event); - void show_settings(wxCommandEvent& event); };