generated from Persson-dev/Godot-Xmake
make world abstract
All checks were successful
Linux arm64 / Build (pull_request) Successful in 1m36s
All checks were successful
Linux arm64 / Build (pull_request) Successful in 1m36s
This commit is contained in:
19
include/client/ClientWorld.h
Normal file
19
include/client/ClientWorld.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <blitz/godot/World.h>
|
||||
|
||||
namespace blitz {
|
||||
|
||||
class ClientWorld : public World {
|
||||
GDCLASS(ClientWorld, World)
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
ClientWorld();
|
||||
~ClientWorld();
|
||||
void _process(float delta);
|
||||
|
||||
private:
|
||||
void UpdatePlayerPos();
|
||||
};
|
||||
|
||||
} // namespace blitz
|
||||
@@ -13,7 +13,9 @@ class Main : public godot::Node {
|
||||
Main();
|
||||
~Main();
|
||||
|
||||
void ChangeScene();
|
||||
void _ready() override;
|
||||
|
||||
void ChangeScene(bool a_Server);
|
||||
};
|
||||
|
||||
} // namespace blitz
|
||||
@@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <godot_cpp/classes/node3d.hpp>
|
||||
|
||||
#include <blitz/protocol/PacketHandler.h>
|
||||
|
||||
namespace blitz {
|
||||
|
||||
class Player;
|
||||
class NetworkInterface;
|
||||
|
||||
class World : public godot::Node3D, public protocol::PacketHandler {
|
||||
GDCLASS(World, godot::Node3D)
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
World();
|
||||
~World();
|
||||
|
||||
// Godot overrides
|
||||
void _ready() override;
|
||||
void _process(float delta);
|
||||
|
||||
Player* GetPlayerById(PlayerID a_PlayerId);
|
||||
|
||||
void HandlePacket(const protocol::packets::PlayerJoin&) override;
|
||||
void HandlePacket(const protocol::packets::PlayerLeave&) override;
|
||||
void HandlePacket(const protocol::packets::PlayerPositionAndRotation&) override;
|
||||
|
||||
private:
|
||||
NetworkInterface* m_NetworkInterface;
|
||||
godot::Node* m_Players;
|
||||
float m_PassedTime;
|
||||
|
||||
|
||||
void AddPlayer(PlayerID a_PlayerId, godot::String a_PlayerName);
|
||||
void RemovePlayer(PlayerID a_PlayerId);
|
||||
void SetPlayerPositionAndRotation(PlayerID a_PlayerId, const godot::Vector3& a_Position, const godot::Vector3& a_Rotation);
|
||||
};
|
||||
} // namespace blitz
|
||||
Reference in New Issue
Block a user