Created
October 4, 2018 20:30
-
-
Save ChristianHohlfeld/c671eb8753d19660b861a593c5d679a3 to your computer and use it in GitHub Desktop.
MyMessage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TestMessage.hpp | |
// UDPTEST | |
// | |
// Created by Christian Hohlfeld on 16.09.18. | |
// | |
#ifndef TestMessage_hpp | |
#define TestMessage_hpp | |
#include "yojimbo.h" | |
#include <stdio.h> | |
struct TestData | |
{ | |
TestData() | |
{ | |
memset( this, 0, sizeof( TestData ) ); | |
} | |
int a,b,c; | |
uint32_t d : 8; | |
uint32_t e : 8; | |
uint32_t f : 8; | |
bool g; | |
int numItems; | |
// int items[MaxItems]; | |
float float_valueX; | |
float float_valueY; | |
float float_valueRotation; | |
double double_value; | |
uint64_t uint64_value; | |
uint8_t bytes[17]; | |
char string[yojimbo::MaxAddressLength]; | |
}; | |
class MyMessage : public yojimbo::Message { | |
public: | |
TestData data; | |
template <typename Stream> | |
bool Serialize(Stream& stream) { | |
serialize_float_internal(stream, data.float_valueX); | |
serialize_float_internal(stream, data.float_valueY); | |
serialize_float_internal(stream, data.float_valueRotation); | |
//serialize_string(stream, data.string, sizeof(data.string)); | |
return true; | |
} | |
YOJIMBO_VIRTUAL_SERIALIZE_FUNCTIONS(); | |
}; | |
#endif /* TestMessage_hpp */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment