2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2009-07-06 02:10:26 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#ifndef _NETWINDOW_H_
|
|
|
|
#define _NETWINDOW_H_
|
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
#include "CommonTypes.h"
|
|
|
|
|
|
|
|
#include <queue>
|
2009-07-06 02:10:26 +00:00
|
|
|
#include <string>
|
2010-05-01 19:10:35 +00:00
|
|
|
|
2009-07-06 02:10:26 +00:00
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/notebook.h>
|
|
|
|
#include <wx/gbsizer.h>
|
|
|
|
#include <wx/listbox.h>
|
2010-05-05 04:31:21 +00:00
|
|
|
#include <wx/spinctrl.h>
|
2010-05-01 19:10:35 +00:00
|
|
|
|
|
|
|
#include "GameListCtrl.h"
|
|
|
|
|
2010-11-16 01:55:29 +00:00
|
|
|
#include "FifoQueue.h"
|
2010-05-01 19:10:35 +00:00
|
|
|
|
2011-02-08 15:36:15 +00:00
|
|
|
#include "NetPlay.h"
|
|
|
|
|
2010-05-02 23:01:50 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
NP_GUI_EVT_CHANGE_GAME = 45,
|
|
|
|
NP_GUI_EVT_START_GAME,
|
|
|
|
NP_GUI_EVT_STOP_GAME,
|
|
|
|
};
|
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
class NetPlaySetupDiag : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
2010-05-02 23:01:50 +00:00
|
|
|
NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list);
|
2010-06-06 03:52:11 +00:00
|
|
|
~NetPlaySetupDiag();
|
2010-05-01 19:10:35 +00:00
|
|
|
private:
|
|
|
|
void OnJoin(wxCommandEvent& event);
|
|
|
|
void OnHost(wxCommandEvent& event);
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
wxTextCtrl *m_nickname_text,
|
|
|
|
*m_host_port_text,
|
|
|
|
*m_connect_port_text,
|
|
|
|
*m_connect_ip_text;
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
wxListBox* m_game_lbox;
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
const CGameListCtrl* const m_game_list;
|
2009-07-06 02:10:26 +00:00
|
|
|
};
|
|
|
|
|
2011-02-08 15:36:15 +00:00
|
|
|
class NetPlayDiag : public wxFrame, public NetPlayUI
|
2009-07-06 02:10:26 +00:00
|
|
|
{
|
2010-05-01 19:10:35 +00:00
|
|
|
public:
|
2010-05-02 23:01:50 +00:00
|
|
|
NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game_list
|
2010-05-01 19:10:35 +00:00
|
|
|
, const std::string& game, const bool is_hosting = false);
|
|
|
|
~NetPlayDiag();
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2010-11-16 01:55:29 +00:00
|
|
|
Common::FifoQueue<std::string> chat_msgs;
|
2010-05-01 19:10:35 +00:00
|
|
|
|
|
|
|
void OnStart(wxCommandEvent& event);
|
2010-05-02 23:01:50 +00:00
|
|
|
void OnStop(wxCommandEvent& event);
|
2010-05-01 19:10:35 +00:00
|
|
|
|
2011-02-08 15:36:15 +00:00
|
|
|
// implementation of NetPlayUI methods
|
|
|
|
void BootGame(const std::string& filename);
|
|
|
|
void StopGame();
|
|
|
|
|
|
|
|
void Update();
|
|
|
|
void AppendChat(const std::string& msg);
|
|
|
|
|
|
|
|
void OnMsgChangeGame(const std::string& filename);
|
|
|
|
void OnMsgStartGame();
|
|
|
|
void OnMsgStopGame();
|
|
|
|
|
2011-02-27 02:27:43 +00:00
|
|
|
static NetPlayDiag *&GetInstance() { return npd; };
|
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
void OnChat(wxCommandEvent& event);
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
2010-05-05 04:31:21 +00:00
|
|
|
void OnPadBuffHelp(wxCommandEvent& event);
|
2010-05-01 19:10:35 +00:00
|
|
|
void OnThread(wxCommandEvent& event);
|
2010-05-02 23:01:50 +00:00
|
|
|
void OnChangeGame(wxCommandEvent& event);
|
2010-05-05 04:31:21 +00:00
|
|
|
void OnAdjustBuffer(wxCommandEvent& event);
|
2010-06-06 03:52:11 +00:00
|
|
|
void OnConfigPads(wxCommandEvent& event);
|
2010-05-01 19:10:35 +00:00
|
|
|
|
|
|
|
wxListBox* m_player_lbox;
|
|
|
|
wxTextCtrl* m_chat_text;
|
|
|
|
wxTextCtrl* m_chat_msg_text;
|
|
|
|
|
|
|
|
std::string m_selected_game;
|
|
|
|
wxButton* m_game_btn;
|
|
|
|
|
2010-06-06 03:52:11 +00:00
|
|
|
std::vector<int> m_playerids;
|
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
const CGameListCtrl* const m_game_list;
|
2011-02-27 02:27:43 +00:00
|
|
|
|
|
|
|
static NetPlayDiag* npd;
|
2009-07-06 02:10:26 +00:00
|
|
|
};
|
|
|
|
|
2010-05-01 19:10:35 +00:00
|
|
|
DECLARE_EVENT_TYPE(wxEVT_THREAD, -1)
|
|
|
|
|
2010-05-02 23:01:50 +00:00
|
|
|
class ChangeGameDiag : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ChangeGameDiag(wxWindow* const parent, const CGameListCtrl* const game_list, wxString& game_name);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnPick(wxCommandEvent& event);
|
|
|
|
|
|
|
|
wxListBox* m_game_lbox;
|
|
|
|
wxString& m_game_name;
|
|
|
|
};
|
|
|
|
|
2010-06-06 03:52:11 +00:00
|
|
|
class PadMapDiag : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PadMapDiag(wxWindow* const parent, int map[]);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnAdjust(wxCommandEvent& event);
|
|
|
|
|
|
|
|
wxChoice* m_map_cbox[4];
|
|
|
|
int* const m_mapping;
|
|
|
|
};
|
|
|
|
|
2009-07-06 02:10:26 +00:00
|
|
|
#endif // _NETWINDOW_H_
|
|
|
|
|