# HG changeset patch # User John Tsiombikas # Date 1423171220 -7200 # Node ID 66d1762eb2038ba4e000519a1f2d165692f3aeaa # Parent 4a1c9597f4d349db21a65724e30f943fd1edf59c foo diff -r 4a1c9597f4d3 -r 66d1762eb203 Makefile --- a/Makefile Thu Feb 05 11:04:07 2015 +0200 +++ b/Makefile Thu Feb 05 23:20:20 2015 +0200 @@ -2,11 +2,15 @@ obj = $(ccsrc:.cc=.o) bin = test -CXXFLAGS = -pedantic -Wall -g +warn = -pedantic -Wall +dbg = -g + +CXXFLAGS = $(warn) $(dbg) LDFLAGS = $(libgl) -lm -lvmath ifeq ($(shell uname -s), Darwin) libgl = -framework OpenGL -framework GLUT -lGLEW + warn += -Wno-deprecated-declarations else libgl = -lGL -lGLU -lglut -lGLEW endif diff -r 4a1c9597f4d3 -r 66d1762eb203 src/comp.cc --- a/src/comp.cc Thu Feb 05 11:04:07 2015 +0200 +++ b/src/comp.cc Thu Feb 05 23:20:20 2015 +0200 @@ -32,7 +32,10 @@ void register_component(const char *name, Component *(*cons_func)()) { - comp_cons[name] = cons_func; + if(!comp_cons[name]) { + printf("register component: %s\n", name); + comp_cons[name] = cons_func; + } } Component *create_component(const char *name) diff -r 4a1c9597f4d3 -r 66d1762eb203 src/comp_phys.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/comp_phys.cc Thu Feb 05 23:20:20 2015 +0200 @@ -0,0 +1,20 @@ +#include "comp_phys.h" + +static CompRigid reg_co_rigid; + +static Component *cons_rigid() { return new CompRigid; } + +CompRigid::CompRigid() +{ + mass = 1.0; + elast = 0.5; + friction = 0.0; + + name = "rigid"; + + register_component(name, cons_rigid); +} + +void CompRigid::update() +{ +} diff -r 4a1c9597f4d3 -r 66d1762eb203 src/comp_phys.h --- a/src/comp_phys.h Thu Feb 05 11:04:07 2015 +0200 +++ b/src/comp_phys.h Thu Feb 05 23:20:20 2015 +0200 @@ -4,17 +4,14 @@ #include #include "comp.h" -class CompRigid : public CompPRS { +class CompRigid : public Component { public: float mass, elast, friction; Vector3 pos, vel; - CompRigid() - { - mass = 1.0; - elast = 0.5; - friction = 0.0; - } + CompRigid(); + + void update(); }; #endif // COMP_PHYS_H_ diff -r 4a1c9597f4d3 -r 66d1762eb203 src/comp_xform.cc --- a/src/comp_xform.cc Thu Feb 05 11:04:07 2015 +0200 +++ b/src/comp_xform.cc Thu Feb 05 23:20:20 2015 +0200 @@ -2,6 +2,9 @@ #include "comp_xform.h" #include "gameobj.h" +static CompXForm reg_co_xform; +static CompPRS reg_co_prs; + static Component *cons_xform() { return new CompXForm; } static Component *cons_prs() { return new CompPRS; }