coeng

changeset 3:66d1762eb203

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 05 Feb 2015 23:20:20 +0200
parents 4a1c9597f4d3
children 49a2e70ac455
files Makefile src/comp.cc src/comp_phys.cc src/comp_phys.h src/comp_xform.cc
diffstat 5 files changed, 36 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/Makefile	Thu Feb 05 11:04:07 2015 +0200
     1.2 +++ b/Makefile	Thu Feb 05 23:20:20 2015 +0200
     1.3 @@ -2,11 +2,15 @@
     1.4  obj = $(ccsrc:.cc=.o)
     1.5  bin = test
     1.6  
     1.7 -CXXFLAGS = -pedantic -Wall -g
     1.8 +warn = -pedantic -Wall
     1.9 +dbg = -g
    1.10 +
    1.11 +CXXFLAGS = $(warn) $(dbg)
    1.12  LDFLAGS = $(libgl) -lm -lvmath
    1.13  
    1.14  ifeq ($(shell uname -s), Darwin)
    1.15  	libgl = -framework OpenGL -framework GLUT -lGLEW
    1.16 +	warn += -Wno-deprecated-declarations
    1.17  else
    1.18  	libgl = -lGL -lGLU -lglut -lGLEW
    1.19  endif
     2.1 --- a/src/comp.cc	Thu Feb 05 11:04:07 2015 +0200
     2.2 +++ b/src/comp.cc	Thu Feb 05 23:20:20 2015 +0200
     2.3 @@ -32,7 +32,10 @@
     2.4  
     2.5  void register_component(const char *name, Component *(*cons_func)())
     2.6  {
     2.7 -	comp_cons[name] = cons_func;
     2.8 +	if(!comp_cons[name]) {
     2.9 +		printf("register component: %s\n", name);
    2.10 +		comp_cons[name] = cons_func;
    2.11 +	}
    2.12  }
    2.13  
    2.14  Component *create_component(const char *name)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/comp_phys.cc	Thu Feb 05 23:20:20 2015 +0200
     3.3 @@ -0,0 +1,20 @@
     3.4 +#include "comp_phys.h"
     3.5 +
     3.6 +static CompRigid reg_co_rigid;
     3.7 +
     3.8 +static Component *cons_rigid() { return new CompRigid; }
     3.9 +
    3.10 +CompRigid::CompRigid()
    3.11 +{
    3.12 +	mass = 1.0;
    3.13 +	elast = 0.5;
    3.14 +	friction = 0.0;
    3.15 +
    3.16 +	name = "rigid";
    3.17 +
    3.18 +	register_component(name, cons_rigid);
    3.19 +}
    3.20 +
    3.21 +void CompRigid::update()
    3.22 +{
    3.23 +}
     4.1 --- a/src/comp_phys.h	Thu Feb 05 11:04:07 2015 +0200
     4.2 +++ b/src/comp_phys.h	Thu Feb 05 23:20:20 2015 +0200
     4.3 @@ -4,17 +4,14 @@
     4.4  #include <vmath/vmath.h>
     4.5  #include "comp.h"
     4.6  
     4.7 -class CompRigid : public CompPRS {
     4.8 +class CompRigid : public Component {
     4.9  public:
    4.10  	float mass, elast, friction;
    4.11  	Vector3 pos, vel;
    4.12  
    4.13 -	CompRigid()
    4.14 -	{
    4.15 -		mass = 1.0;
    4.16 -		elast = 0.5;
    4.17 -		friction = 0.0;
    4.18 -	}
    4.19 +	CompRigid();
    4.20 +
    4.21 +	void update();
    4.22  };
    4.23  
    4.24  #endif	// COMP_PHYS_H_
     5.1 --- a/src/comp_xform.cc	Thu Feb 05 11:04:07 2015 +0200
     5.2 +++ b/src/comp_xform.cc	Thu Feb 05 23:20:20 2015 +0200
     5.3 @@ -2,6 +2,9 @@
     5.4  #include "comp_xform.h"
     5.5  #include "gameobj.h"
     5.6  
     5.7 +static CompXForm reg_co_xform;
     5.8 +static CompPRS reg_co_prs;
     5.9 +
    5.10  static Component *cons_xform() { return new CompXForm; }
    5.11  static Component *cons_prs() { return new CompPRS; }
    5.12