Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
NetPlay: Disable the "Start" button while the game is running
  • Loading branch information
magcius committed Aug 14, 2013
1 parent 1c74e41 commit 9981942
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/Core/DolphinWX/Src/NetWindow.cpp
Expand Up @@ -283,6 +283,7 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game
: wxFrame(parent, wxID_ANY, wxT(NETPLAY_TITLEBAR), wxDefaultPosition, wxDefaultSize)
, m_selected_game(game)
, m_game_list(game_list)
, m_start_btn(NULL)
{
wxPanel* const panel = new wxPanel(this);

Expand Down Expand Up @@ -340,9 +341,10 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game
wxBoxSizer* const bottom_szr = new wxBoxSizer(wxHORIZONTAL);
if (is_hosting)
{
wxButton* const start_btn = new wxButton(panel, wxID_ANY, _("Start"));
start_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlayDiag::OnStart, this);
bottom_szr->Add(start_btn);
m_start_btn = new wxButton(panel, wxID_ANY, _("Start"));
m_start_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlayDiag::OnStart, this);
bottom_szr->Add(m_start_btn);

bottom_szr->Add(new wxStaticText(panel, wxID_ANY, _("Buffer:")), 0, wxLEFT | wxCENTER, 5 );
wxSpinCtrl* const padbuf_spin = new wxSpinCtrl(panel, wxID_ANY, wxT("20")
, wxDefaultPosition, wxSize(64, -1), wxSP_ARROW_KEYS, 0, 200, INITIAL_PAD_BUFFER_SIZE);
Expand Down Expand Up @@ -463,12 +465,16 @@ void NetPlayDiag::OnMsgStartGame()
{
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME);
GetEventHandler()->AddPendingEvent(evt);
if (m_start_btn)
m_start_btn->Disable();
}

void NetPlayDiag::OnMsgStopGame()
{
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME);
GetEventHandler()->AddPendingEvent(evt);
if (m_start_btn)
m_start_btn->Enable();
}

void NetPlayDiag::OnAdjustBuffer(wxCommandEvent& event)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinWX/Src/NetWindow.h
Expand Up @@ -100,6 +100,7 @@ class NetPlayDiag : public wxFrame, public NetPlayUI

std::string m_selected_game;
wxButton* m_game_btn;
wxButton* m_start_btn;

std::vector<int> m_playerids;

Expand Down

0 comments on commit 9981942

Please sign in to comment.