generated from Persson-dev/Godot-Xmake
35 lines
681 B
C++
35 lines
681 B
C++
#pragma once
|
|
|
|
#include "PlayerInfo.h"
|
|
#include <godot_cpp/classes/node.hpp>
|
|
#include <map>
|
|
|
|
namespace blitz {
|
|
|
|
class Lobby : public godot::Node {
|
|
GDCLASS(Lobby, godot::Node)
|
|
protected:
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
Lobby();
|
|
~Lobby();
|
|
|
|
void _ready() override;
|
|
|
|
godot::Error JoinGame(const godot::String& a_Address, uint16_t a_Port);
|
|
godot::Error CreateGame(uint16_t a_Port, bool a_Dedicated = false);
|
|
|
|
void Shutdown();
|
|
|
|
private:
|
|
std::map<int32_t, PlayerInfo> m_Players;
|
|
|
|
void OnPlayerConnected(int32_t a_PeerId);
|
|
void OnPlayerDisconnected(int32_t a_PeerId);
|
|
void OnConnectOk();
|
|
void OnConnectFail();
|
|
void OnServerDisconnected();
|
|
};
|
|
|
|
} // namespace blitz
|