coeng

diff src/comp.h @ 2:4a1c9597f4d3

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