![]() |
R-Type
2
Doom but in better
|
#include <cstddef>
#include <sstream>
#include <cstdint>
#include <cstring>
Go to the source code of this file.
Data Structures | |
struct | coord |
A structure representing coordinates in a 2D space. More... | |
struct | messageInfo |
A structure containing information about a game message. More... | |
struct | GameMessage |
A structure representing a game message. More... | |
Enumerations | |
enum | messageType : uint8_t { P_EMPTY , P_CONNECT , P_DISCONNECT , P_MOVE , P_SHOOT , P_SPAWN , P_KILL , P_DAMAGE , P_HEAL , P_BUFF , P_STATUS , P_ERROR = 0xFF } |
Enum representing the different types of game messages. More... | |
Functions | |
GameMessage | deserialize (std::istringstream &is) |
Deserializes a GameMessage object from a binary stream. | |
void | serialize (const GameMessage &message, std::ostringstream &os) |
Serializes a GameMessage object into a binary stream. | |
enum messageType : uint8_t |
Enum representing the different types of game messages.
The messageType
enum defines various message types used for communication in the game, such as events like spawning, movement, damage, and status updates.
Definition at line 14 of file GameMessage.hpp.
GameMessage deserialize | ( | std::istringstream & | is | ) |
Deserializes a GameMessage object from a binary stream.
This function reads binary data from the provided input stream and reconstructs a GameMessage
object. The binary data should have been written using the serialize
function.
is | The input stream from which the binary data will be read. |
GameMessage
object. Definition at line 54 of file GameMessage.cpp.
void serialize | ( | const GameMessage & | message, |
std::ostringstream & | os ) |
Serializes a GameMessage object into a binary stream.
This function writes the GameMessage
object's data to the provided output stream in binary format. The serialized data can later be read using the deserialize
function.
message | The GameMessage object to serialize. |
os | The output stream to which the binary data will be written. |
Definition at line 3 of file GameMessage.cpp.