[Plib-cvs] plib/demos/simon/src Makefile,1.2,1.3 simon.h,1.1,1.2 simon_api.cxx,1.1,1.2
Brought to you by:
sjbaker
From: Sebastian U. <ud...@us...> - 2002-09-15 01:44:49
|
Update of /cvsroot/plib/plib/demos/simon/src In directory usw-pr-cvs1:/tmp/cvs-serv28307 Modified Files: Makefile simon.h simon_api.cxx Log Message: Const-correctness; Global namespace pollution Index: Makefile =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 14 Sep 2002 20:52:42 -0000 1.2 +++ Makefile 15 Sep 2002 01:44:46 -0000 1.3 @@ -1,17 +1,17 @@ SIMON = libsimon.a simon -LIBS = -lplibpsl -lplibssg -lplibsg -lplibul -lglut -lGLU -lGL -lpthread -L/usr/X11/lib -lX11 -lm +LIBS = -L/usr/X11R6/lib -lplibpsl -lplibssg -lplibsg -lplibul -lglut -lGLU -lGL -lpthread -lX11 -lm all: ${SIMON} -simon : libsimon.a simon.o /usr/lib/libplibpsl.a +simon : libsimon.a simon.o g++ -o simon simon.o libsimon.a ${LIBS} simon.o : simon.cxx simon.h - g++ -I. -o simon.o -c simon.cxx + g++ -I/usr/X11R6/include -I. -o simon.o -c simon.cxx simon_api.o : simon_api.cxx simon.h - g++ -o simon_api.o -c simon_api.cxx + g++ -I/usr/X11R6/include -o simon_api.o -c simon_api.cxx libsimon.a : simon_api.o ar cru libsimon.a simon_api.o Index: simon.h =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- simon.h 14 Sep 2002 19:50:29 -0000 1.1 +++ simon.h 15 Sep 2002 01:44:46 -0000 1.2 @@ -15,7 +15,7 @@ void siUpdate () ; void siRun () ; -int siLoad ( char *filename ) ; +int siLoad ( const char *filename ) ; void siPosition ( int hh, float x, float y, float z = 0.0f, float h = 0.0f, Index: simon_api.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/simon/src/simon_api.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- simon_api.cxx 14 Sep 2002 20:52:42 -0000 1.1 +++ simon_api.cxx 15 Sep 2002 01:44:46 -0000 1.2 @@ -20,7 +20,7 @@ public: - siEntity ( char *_fname ) + siEntity ( const char *_fname ) { siModels [ siNextModel ] = this ; @@ -32,20 +32,19 @@ exit ( 1 ) ; } - name = new char [ strlen(_fname)+1 ] ; - strcpy ( name, _fname ) ; + name = ulStrDup ( _fname ) ; sgZeroCoord ( & pos ) ; sgZeroCoord ( & vel ) ; } - int getHandle () { return handle ; } + int getHandle () const { return handle ; } - float getPositionX () { return pos.xyz[0] ; } - float getPositionY () { return pos.xyz[1] ; } - float getPositionZ () { return pos.xyz[2] ; } - float getPositionH () { return pos.hpr[0] ; } - float getPositionP () { return pos.hpr[1] ; } - float getPositionR () { return pos.hpr[2] ; } + float getPositionX () const { return pos.xyz[0] ; } + float getPositionY () const { return pos.xyz[1] ; } + float getPositionZ () const { return pos.xyz[2] ; } + float getPositionH () const { return pos.hpr[0] ; } + float getPositionP () const { return pos.hpr[1] ; } + float getPositionR () const { return pos.hpr[2] ; } void setSpeedAndDirection ( float s, float h, float p ) { @@ -103,7 +102,7 @@ public: - siModel ( char *_fname ) : siEntity ( _fname ) + siModel ( const char *_fname ) : siEntity ( _fname ) { tra = new ssgTransform ; ent = ssgLoad ( name ) ; @@ -123,7 +122,7 @@ } ; -siEntity *getModel ( int i ) +static siEntity *getModel ( int i ) { if ( i < 0 || i >= SI_MAX_MODELS || siModels [ i ] == NULL ) @@ -184,12 +183,12 @@ -jsJoystick js (0) ; +static jsJoystick js (0) ; -bool A, B, C, D, L, R ; +static bool A, B, C, D, L, R ; -float leftright ; -float updown ; +static float leftright ; +static float updown ; static void read_joystick () { @@ -320,7 +319,7 @@ /* Load a simple model */ -int siLoad ( char *filename ) +int siLoad ( const char *filename ) { if ( ! siInitialised ) siInit () ; |