generated from Persson-dev/Godot-Xmake
moved network interface
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
#include <client/NetworkInterface.h>
|
||||
|
||||
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:
|
||||
void OnPlayerConnected(PeerID a_PeerId);
|
||||
void OnPlayerDisconnected(PeerID a_PeerId);
|
||||
void OnConnectOk();
|
||||
void OnConnectFail();
|
||||
void OnServerDisconnected();
|
||||
};
|
||||
|
||||
} // namespace blitz
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <godot_cpp/classes/button.hpp>
|
||||
#include <godot_cpp/classes/control.hpp>
|
||||
#include <blitz/godot/NetworkInterface.h>
|
||||
|
||||
namespace blitz {
|
||||
|
||||
@@ -22,11 +23,17 @@ class MainMenu : public godot::Control {
|
||||
godot::Button* m_CreateButton;
|
||||
godot::Button* m_QuitButton;
|
||||
|
||||
NetworkInterface* m_NetworkInterface;
|
||||
|
||||
void OnConnected();
|
||||
void OnDisconnected();
|
||||
|
||||
void OnJoinPressed();
|
||||
void OnCreatePressed();
|
||||
void OnQuitPressed();
|
||||
|
||||
void DisableButtons();
|
||||
void EnableButtons();
|
||||
};
|
||||
|
||||
} // namespace blitz
|
||||
@@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <blitz/protocol/Packets.h>
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
#include <blitz/protocol/PacketDispatcher.h>
|
||||
|
||||
namespace blitz {
|
||||
class NetworkInterface : public godot::Node, public protocol::PacketDispatcher {
|
||||
GDCLASS(NetworkInterface, godot::Node)
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
NetworkInterface();
|
||||
~NetworkInterface();
|
||||
|
||||
void BroadcastPacket(const protocol::Packet& a_Packet);
|
||||
void SendPacket(PeerID a_Peer, const protocol::Packet& a_Packet);
|
||||
|
||||
void _ready() override;
|
||||
|
||||
private:
|
||||
void RecievePacketDataReliable(godot::PackedByteArray a_PacketData);
|
||||
};
|
||||
|
||||
} // namespace blitz
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
#include <blitz/common/Types.h>
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
|
||||
namespace blitz {
|
||||
|
||||
@@ -19,14 +19,14 @@ class Server : public godot::Node {
|
||||
|
||||
void _ready() override;
|
||||
|
||||
void OnPlayerConnect(PeerID a_PeerId);
|
||||
void OnPlayerDisconnect(PeerID a_PeerId);
|
||||
void OnPlayerConnect(PeerID a_PeerId);
|
||||
void OnPlayerDisconnect(PeerID a_PeerId);
|
||||
|
||||
private:
|
||||
Lobby* m_Lobby;
|
||||
NetworkInterface* m_NetworkInterface;
|
||||
Lobby* m_Lobby;
|
||||
NetworkInterface* m_NetworkInterface;
|
||||
|
||||
godot::TypedArray<PeerID> m_Peers;
|
||||
godot::TypedArray<PeerID> m_Peers;
|
||||
};
|
||||
|
||||
} // namespace blitz
|
||||
Reference in New Issue
Block a user