WIP Model component not working.

This commit is contained in:
Jocke
2016-01-11 14:34:04 +01:00
parent 6c13916eec
commit b37ffc7449
8 changed files with 204 additions and 67 deletions
+2
View File
@@ -22,6 +22,8 @@ public:
void RegisterComponent(ComponentInfo& ci);
// Attach a component to an entity and fill it with default values
ComponentWrapper AttachComponent(EntityID entity, std::string componentType);
// Check if world has an entity
bool HasEntity(EntityID entity);
// Check if an entity has a component
bool HasComponent(EntityID entity, std::string componentType) const;
// Get a component of an entity
+5 -1
View File
@@ -14,8 +14,9 @@ public:
Packet(MessageType type, unsigned int& packetID);
// Used to create packet from already existing data buffer.
Packet(char* data, const int sizeOfPacket);
~Packet();
void Init(MessageType type, unsigned int& packetID);
// Add primitive types like int, float, char...
template<typename T>
void WritePrimitive(T val)
@@ -23,6 +24,7 @@ public:
// Check if we are trying to add more than the package can fit.
if (m_MaxPacketSize < m_Offset + sizeof(T)) {
LOG_WARNING("Packet AddPrimitive(): You are trying to add more than we have allocated for!");
return;
}
memcpy(m_Data + m_Offset, &val, sizeof(T));
m_Offset += sizeof(T);
@@ -50,6 +52,8 @@ public:
int Size() { return m_Offset; };
char* Data() { return m_Data; };
unsigned int DataReadSize() { return m_ReturnDataOffset; }
unsigned int MaxSize() { return m_MaxPacketSize; }
private:
char* m_Data;
+1
View File
@@ -67,6 +67,7 @@ private:
void moveMessageHead(char*& data, size_t& length, size_t stepSize);
void broadcast(std::string message);
void broadcast(Packet& packet);
//void parseShitTest(Packet& packet); // Remove this when network is working
void sendSnapshot();
void sendPing();
void checkForTimeOuts();