Changeset 1850 in orxonox.OLD for orxonox/trunk/core
- Timestamp:
- Apr 21, 2004, 1:11:19 AM (21 years ago)
- Location:
- orxonox/trunk/core
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/Makefile
r1849 r1850 1 1 2 CPLUSPLUS = g++ 2 CC = gcc 3 CXX = g++ 3 4 APP_LIB_DEPS = -lglut -lGLU -lGL -lm -L/usr/X11R6/lib -lXt -lX11 4 5 GL_LIB = libGL.so … … 8 9 OSMESA_LIB = libOSMesa.so 9 10 10 CFLAGS = -O3 - ansi -pedantic -fPIC -ffast-math -I/usr/X11R6/include11 CFLAGS = -O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include 11 12 CXXFLAGS = -fPIC -O3 12 13 GLUT_CFLAGS = -fexceptions … … 25 26 orxonox \ 26 27 28 HEADERS = \ 29 orxonox.h \ 30 data_core.h 31 32 SOURCES = \ 33 orxonox.cc \ 34 data_core.cc 35 36 OBJECTS = \ 37 orxonox.o \ 38 data_tank.o 39 40 TARGET = orxonox 41 27 42 .SUFFIXES: 28 43 .SUFFIXES: .cc 29 44 30 .cc: $(LIB_DEP)31 $(CPLUSPLUS) -I$(INCDIR) $(CFLAGS) $< $(LIBS) -o $@45 #.cc: $(LIB_DEP) 46 # $(CXX) -I$(INCDIR) $(CFLAGS) $< $(LIBS) -o $@ 32 47 33 default: 34 targets: $(PROGS) 48 .cc.o: 49 $(CXX) -c $(CFLAGS) -I$(INCDIR) -o $@ $< 50 51 52 #### build 53 54 all: $(TARGET) 55 56 $(TARGET): $(LIB_DEP) $(OBJECTS) 57 $(CXX) $(LIBS) -o $(TARGET) $(OBJECTS) 58 59 60 help: 61 @echo "Cleaning targets:" 62 @echo " clean - remove most generated files" 63 @echo "" 64 @echo "Generic targets:" 65 @echo " all - Build all targets" 66 @echo "" 67 @echo "For further info see the README file" 35 68 36 37 69 clean: 38 70 rm -rf *.o *~ $(PROGS) 39 71 72 73 ####compile 74 75 orxonox.o: orxonox.cc \ 76 orxonox.h \ 77 78 data_tank.o: data_tank.cc \ 79 data_tank.h 80 81 #EOF -
orxonox/trunk/core/orxonox.cc
r1849 r1850 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software Foundation, 18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 20 */ 21 22 23 24 25 26 1 27 /* class definition header */ 2 28 #include "orxonox.h" … … 13 39 14 40 15 Orxonox::Orxonox() {} 16 Orxonox::~Orxonox() {} 41 Orxonox::Orxonox () {} 17 42 18 43 19 int Orxonox::globalInit(int argc, char** argv) 44 45 Orxonox::~Orxonox () {} 46 47 48 /* this is a singleton class to prevent dublicates */ 49 Orxonox* Orxonox::singleton_ref = 0; 50 Orxonox* Orxonox::getInstance (void) 51 { 52 if (singleton_ref == NULL) 53 singleton_ref = new Orxonox(); 54 return singleton_ref; 55 } 56 57 58 59 int Orxonox::globalInit (int argc, char** argv) 20 60 { 21 61 glutInit(&argc, argv); … … 25 65 glutCreateWindow("orxOnox"); 26 66 /* window event dispatchers */ 27 /* 28 glutDisplayFunc(display); 29 glutReshapeFunc(resphape); 30 glutMainLoop(); 31 */ 67 glutDisplayFunc(display); 68 glutReshapeFunc(reshape); 32 69 } 33 70 34 71 35 int Orxonox::menuInit() 72 73 int Orxonox::menuInit (void) 36 74 { 37 75 glClearColor(0.0, 0.0, 0.0, 0.0); 76 } 77 78 79 80 int Orxonox::gameInit (void) 81 { 38 82 39 83 } … … 41 85 42 86 43 int Orxonox::gameInit()87 void Orxonox::display (void) 44 88 { 89 glClear(GL_COLOR_BUFFER_BIT); 90 glutSwapBuffers(); 91 } 45 92 93 94 95 void Orxonox::reshape (int w, int h) 96 { 97 glViewport(0, 0, (GLsizei) w, (GLsizei) h); 98 glMatrixMode(GL_PROJECTION); 99 glLoadIdentity(); 100 glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); 101 glMatrixMode(GL_MODELVIEW); 102 glLoadIdentity(); //pb why a second time? 46 103 } 47 104 48 105 49 int main( int argc, char** argv ) 106 107 int main (int argc, char** argv) 50 108 { 51 Orxonox orx;52 orx.globalInit(argc, argv);53 orx.menuInit();54 109 Orxonox *orx = Orxonox::getInstance(); 110 (*orx).globalInit(argc, argv); 111 (*orx).menuInit(); 112 glutMainLoop(); 55 113 return 0; 56 114 } -
orxonox/trunk/core/orxonox.h
r1803 r1850 2 2 #define ORXONOX_H 3 3 4 #define NULL 0 5 4 6 class Orxonox { 5 7 8 private: 9 static Orxonox *singleton_ref; 10 Orxonox (); 11 ~Orxonox (); 12 6 13 public: 7 Orxonox();8 ~Orxonox();9 14 10 int globalInit(int argc, char** argv); 11 int menuInit(); 12 int gameInit(); 15 static Orxonox* getInstance (void); 13 16 17 int globalInit (int argc, char** argv); 18 int menuInit (void); 19 int gameInit (void); 20 static void display (void); 21 static void reshape (int w, int h); 14 22 }; 15 23 16 24 #endif 25
Note: See TracChangeset
for help on using the changeset viewer.