json serialization beginnings, but still much to do
This commit is contained in:
+14
-7
@@ -2,21 +2,22 @@
|
||||
|
||||
#include "datatypes.h"
|
||||
|
||||
|
||||
class Movable{
|
||||
|
||||
public:
|
||||
Movable() {}
|
||||
virtual ~Movable() {}
|
||||
|
||||
Movable(Vec2D<float> p, Vec2D<float> d, float s) : speed(s), position(p), direction(d) {}
|
||||
Movable(Vec2D<float> p, float s) : speed(s), position(p) {}
|
||||
Movable(Vec2Df p, Vec2Df d, float s) : speed(s), position(p), direction(d) {}
|
||||
Movable(Vec2Df p, float s) : speed(s), position(p) {}
|
||||
|
||||
float speed = 1.0f;
|
||||
|
||||
Vec2D<float> position;
|
||||
Vec2D<float> direction;
|
||||
Vec2Df position;
|
||||
Vec2Df direction;
|
||||
|
||||
Vec2D<float> drag_offset;
|
||||
Vec2Df drag_offset;
|
||||
|
||||
bool in_rect = false;
|
||||
|
||||
@@ -31,8 +32,14 @@ class Movable{
|
||||
|
||||
bool erase = false;
|
||||
|
||||
virtual void setPosition(Vec2D<float> _position) {position = _position;}
|
||||
virtual Vec2D<float> getPosition() {return position;};
|
||||
virtual void setPosition(Vec2Df _position) {position = _position;}
|
||||
virtual Vec2Df getPosition() {return position;};
|
||||
virtual void update(double frametime) {};
|
||||
virtual void update() {};
|
||||
|
||||
/*virtual void to_json(json& j, const Movable& M){*/
|
||||
/* j = json{{"position", M.position}, {"direction", M.direction}, {"speed", M.speed}};*/
|
||||
/*}*/
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Movable, position, direction, speed)
|
||||
|
||||
Reference in New Issue
Block a user