coeng

diff src/comp.h @ 1:b0d8d454c546

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 05 Feb 2015 00:38:59 +0200
parents 14e743b53289
children 4a1c9597f4d3
line diff
     1.1 --- a/src/comp.h	Wed Feb 04 17:23:35 2015 +0200
     1.2 +++ b/src/comp.h	Thu Feb 05 00:38:59 2015 +0200
     1.3 @@ -1,18 +1,44 @@
     1.4  #ifndef COMP_H_
     1.5  #define COMP_H_
     1.6  
     1.7 +#include <string>
     1.8  #include <vmath/vmath.h>
     1.9  
    1.10 +class GameObject;
    1.11 +
    1.12  class Component {
    1.13 +protected:
    1.14 +	char *name;
    1.15 +	GameObject *parent;
    1.16 +	int upd_prio;	// update priority (0: normal)
    1.17 +
    1.18  public:
    1.19  	Component() {}
    1.20  	virtual ~Component() {}
    1.21 +
    1.22 +	const char *get_name() const;
    1.23 +
    1.24 +	virtual void update();
    1.25 +
    1.26 +	bool operator <(const Component &c) const;	// for sorting based on priority
    1.27 +};
    1.28 +
    1.29 +class CompXForm : public Component {
    1.30 +public:
    1.31 +	Matrix4x4 xform;
    1.32 +
    1.33 +	CompXForm();
    1.34  };
    1.35  
    1.36  class CompPRS : public Component {
    1.37 +private:
    1.38 +	CompXForm *co_xform;	// cached xform component of the parent object
    1.39 +
    1.40  public:
    1.41  	Vector3 pos, scale;
    1.42  	Quaternion rot;
    1.43 +
    1.44 +	void update();
    1.45  };
    1.46  
    1.47  #endif	// COMP_H_