mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-08-05 04:29:19 -06:00
basic host/client connect infrastructure, player list
This commit is contained in:
@ -19,8 +19,106 @@
|
||||
#ifndef NETPLAY_H
|
||||
#define NETPLAY_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class NetplayStartHostDialog;
|
||||
class NetplayStartClientDialog;
|
||||
class NetplayDialog;
|
||||
}
|
||||
|
||||
class NetplayStartHostDialog;
|
||||
class NetplayStartClientDialog;
|
||||
class NetplayDialog;
|
||||
|
||||
namespace Netplay
|
||||
{
|
||||
|
||||
struct Player
|
||||
{
|
||||
int ID;
|
||||
char Name[32];
|
||||
int Status; // 0=no player 1=normal 2=host 3=connecting
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class NetplayStartHostDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NetplayStartHostDialog(QWidget* parent);
|
||||
~NetplayStartHostDialog();
|
||||
|
||||
static NetplayStartHostDialog* openDlg(QWidget* parent)
|
||||
{
|
||||
NetplayStartHostDialog* dlg = new NetplayStartHostDialog(parent);
|
||||
dlg->open();
|
||||
return dlg;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void done(int r);
|
||||
|
||||
private:
|
||||
Ui::NetplayStartHostDialog* ui;
|
||||
};
|
||||
|
||||
class NetplayStartClientDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NetplayStartClientDialog(QWidget* parent);
|
||||
~NetplayStartClientDialog();
|
||||
|
||||
static NetplayStartClientDialog* openDlg(QWidget* parent)
|
||||
{
|
||||
NetplayStartClientDialog* dlg = new NetplayStartClientDialog(parent);
|
||||
dlg->open();
|
||||
return dlg;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void done(int r);
|
||||
|
||||
private:
|
||||
Ui::NetplayStartClientDialog* ui;
|
||||
};
|
||||
|
||||
class NetplayDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NetplayDialog(QWidget* parent);
|
||||
~NetplayDialog();
|
||||
|
||||
static NetplayDialog* openDlg(QWidget* parent)
|
||||
{
|
||||
NetplayDialog* dlg = new NetplayDialog(parent);
|
||||
dlg->show();
|
||||
return dlg;
|
||||
}
|
||||
|
||||
void updatePlayerList(Netplay::Player* players, int num);
|
||||
|
||||
signals:
|
||||
void sgUpdatePlayerList(Netplay::Player* players, int num);
|
||||
|
||||
private slots:
|
||||
void done(int r);
|
||||
|
||||
void doUpdatePlayerList(Netplay::Player* players, int num);
|
||||
|
||||
private:
|
||||
Ui::NetplayDialog* ui;
|
||||
};
|
||||
|
||||
namespace Netplay
|
||||
{
|
||||
|
||||
@ -29,8 +127,8 @@ extern bool Active;
|
||||
bool Init();
|
||||
void DeInit();
|
||||
|
||||
void StartHost();
|
||||
void StartClient();
|
||||
void StartHost(const char* player, int port);
|
||||
void StartClient(const char* player, const char* host, int port);
|
||||
|
||||
void StartGame();
|
||||
|
||||
|
Reference in New Issue
Block a user