generated from Persson-dev/Godot-Xmake
begin network
This commit is contained in:
35
src/Lobby.h
Normal file
35
src/Lobby.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user