mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
add Players
This commit is contained in:
parent
5f496eecb2
commit
7027bd6f28
8 changed files with 125 additions and 68 deletions
31
src/objects/Players.hpp
Normal file
31
src/objects/Players.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "typedefs.hpp"
|
||||
#include "interfaces/Serializable.hpp"
|
||||
|
||||
inline constexpr float DEF_PLAYER_Y = 100.0f;
|
||||
inline constexpr float DEF_PLAYER_SPEED = 4.0f;
|
||||
inline constexpr int DEF_PLAYER_INVENTORY_SIZE = 40;
|
||||
|
||||
class Level;
|
||||
class Player;
|
||||
|
||||
class Players : public Serializable {
|
||||
Level* level;
|
||||
std::unordered_map<int64_t, std::unique_ptr<Player>> players;
|
||||
|
||||
void addPlayer(std::unique_ptr<Player> player);
|
||||
public:
|
||||
Players(Level* level);
|
||||
|
||||
Player* getPlayer(int64_t id) const;
|
||||
|
||||
Player* create();
|
||||
|
||||
dv::value serialize() const override;
|
||||
|
||||
void deserialize(const dv::value& src) override;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue