VOX
A little voxel engine
Loading...
Searching...
No Matches
PlayerConnectedPacket.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IPacket.hpp"
4
6{
7public:
9 PlayerConnectedPacket(const uint32_t & id);
10 virtual ~PlayerConnectedPacket();
11
14
17
18 void Serialize(uint8_t * buffer) const override;
19 void Deserialize(const uint8_t * buffer) override;
20 uint32_t Size() const override;
21 bool HasDynamicSize() const override;
22 IPacket::Type GetType() const override;
23
24 std::shared_ptr<IPacket> Clone() const override;
25
26
27 /*******************************
28 * ATTRIBUTES
29 * *****************************/
30 uint32_t GetPlayerId() const;
31
32 void SetPlayerId(uint32_t id);
33private:
34 uint32_t m_player_id;
35};
an abstract class that servers as a base for all network packets
Definition: IPacket.hpp:40
Type
Definition: IPacket.hpp:48
Definition: PlayerConnectedPacket.hpp:6
void SetPlayerId(uint32_t id)
Definition: PlayerConnectedPacket.cpp:88
bool HasDynamicSize() const override
Tell if the packet has a dynamic size.
Definition: PlayerConnectedPacket.cpp:68
void Deserialize(const uint8_t *buffer) override
read the packet from the buffer, the buffer must at least be of size Size()
Definition: PlayerConnectedPacket.cpp:55
uint32_t GetPlayerId() const
Definition: PlayerConnectedPacket.cpp:83
virtual ~PlayerConnectedPacket()
Definition: PlayerConnectedPacket.cpp:12
IPacket::Type GetType() const override
Get the Type of the packet.
Definition: PlayerConnectedPacket.cpp:73
std::shared_ptr< IPacket > Clone() const override
Create a new instance of the packet.
Definition: PlayerConnectedPacket.cpp:78
PlayerConnectedPacket()
Definition: PlayerConnectedPacket.cpp:3
void Serialize(uint8_t *buffer) const override
will write the packet in the buffer, the buffer must at least be of size Size()
Definition: PlayerConnectedPacket.cpp:46
PlayerConnectedPacket & operator=(const PlayerConnectedPacket &other)
Definition: PlayerConnectedPacket.cpp:26
uint32_t Size() const override
return the size of the packet in bytes, usually used to reserve the right amount of memory in the sen...
Definition: PlayerConnectedPacket.cpp:63