jul1278 / SimpleComponents

component-based 2D game engine in SDL
0 stars 1 forks source link

Serialize/Deserialize components #77

Closed jul1278 closed 8 years ago

jul1278 commented 8 years ago

A Serialize(...) and Deserialize(...) function should be provided, either a static member function on each component or a function in a Component namespace. Could look something like this:

bool Serialize(const TransformComponent& transformComponent, map<string, string>* nameValuePairs); 

bool Deserialize(const map<string, string>& nameValuePairs, TransformComponent* component)

So basically we're mapping a component to a table of name-value pairs and returning true/false if successful/failure.

jul1278 commented 8 years ago

Added Serialize/Deserialize functions, should look into a way of automatically generating these though otherwise we'll have to manually write them for each component which would be annoying.