Changeset 3226 in orxonox.OLD for orxonox/trunk/src/orxonox.cc
- Timestamp:
- Dec 20, 2004, 12:27:51 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/orxonox.cc
r3220 r3226 47 47 Orxonox::~Orxonox () 48 48 { 49 Orxonox::singleton _ref = NULL;49 Orxonox::singletonRef = NULL; 50 50 if( world != NULL) delete world; 51 51 if( localinput != NULL) delete world; … … 56 56 57 57 /* this is a singleton class to prevent duplicates */ 58 Orxonox* Orxonox::singleton _ref = 0;58 Orxonox* Orxonox::singletonRef = 0; 59 59 60 60 Orxonox* Orxonox::getInstance (void) 61 61 { 62 if (singleton _ref == NULL)63 singleton _ref = new Orxonox();64 return singleton _ref;62 if (singletonRef == NULL) 63 singletonRef = new Orxonox(); 64 return singletonRef; 65 65 } 66 66 … … 72 72 it's path and name into configfilename 73 73 */ 74 void Orxonox::get _config_file (int argc, char** argv)74 void Orxonox::getConfigFile (int argc, char** argv) 75 75 { 76 76 strcpy (configfilename, "orxonox.conf"); … … 85 85 // config file 86 86 87 get _config_file (argc, argv);87 getConfigFile (argc, argv); 88 88 SDL_Init (SDL_INIT_TIMER); 89 89 // initialize everything 90 if( init _video() == -1) return -1;91 if( init _sound() == -1) return -1;90 if( initVideo() == -1) return -1; 91 if( initSound() == -1) return -1; 92 92 printf("> Initializing input\n"); 93 if( init _input() == -1) return -1;93 if( initInput() == -1) return -1; 94 94 printf("> Initializing networking\n"); 95 if( init _networking () == -1) return -1;95 if( initNetworking () == -1) return -1; 96 96 printf("> Initializing resources\n"); 97 if( init _resources () == -1) return -1;97 if( initResources () == -1) return -1; 98 98 //printf("> Initializing world\n"); 99 99 //if( init_world () == -1) return -1; PB: world will be initialized when started … … 105 105 \brief initializes SDL and OpenGL 106 106 */ 107 int Orxonox::init _video()107 int Orxonox::initVideo() 108 108 { 109 109 printf("> Initializing video\n"); 110 if (SDL_Init 110 if (SDL_Init(SDL_INIT_VIDEO) == -1) 111 111 { 112 112 printf ("could not initialize SDL Video\n"); … … 115 115 // Set video mode 116 116 // TO DO: parse arguments for settings 117 SDL_GL_SetAttribute 118 SDL_GL_SetAttribute 119 SDL_GL_SetAttribute 120 SDL_GL_SetAttribute 117 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 118 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 119 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 120 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 121 121 122 122 int bpp = 16; … … 125 125 Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; 126 126 127 if( 127 if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL) 128 128 { 129 printf 129 printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError()); 130 130 SDL_Quit(); 131 131 return -1; … … 133 133 134 134 // Set window labeling 135 SDL_WM_SetCaption( 135 SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION); 136 136 137 137 // TO DO: Create a cool icon and use it here … … 169 169 \brief initializes the sound engine 170 170 */ 171 int Orxonox::init _sound()171 int Orxonox::initSound() 172 172 { 173 173 printf("> Initializing sound\n"); 174 // SDL_Init 174 // SDL_Init(SDL_INIT_AUDIO); 175 175 printf("Not yet implemented\n"); 176 176 return 0; … … 181 181 \brief initializes input functions 182 182 */ 183 int Orxonox::init _input()183 int Orxonox::initInput() 184 184 { 185 185 // create localinput … … 193 193 \brief initializes network system 194 194 */ 195 int Orxonox::init _networking()195 int Orxonox::initNetworking() 196 196 { 197 197 printf("Not yet implemented\n"); … … 203 203 \brief initializes and loads resource files 204 204 */ 205 int Orxonox::init _resources()205 int Orxonox::initResources() 206 206 { 207 207 printf("Not yet implemented\n"); … … 213 213 \brief initializes the world 214 214 */ 215 int Orxonox::init _world()215 int Orxonox::initWorld() 216 216 { 217 217 //world = new World(); … … 256 256 \param event: an event not handled by the CommandNode 257 257 */ 258 void Orxonox::event _handler(SDL_Event* event)258 void Orxonox::eventHandler(SDL_Event* event) 259 259 { 260 260 // Handle special events such as reshape, quit, focus changes … … 267 267 \return true if the command was handled by the system or false if it may be passed to the WorldEntities 268 268 */ 269 bool Orxonox::system _command(Command* cmd)269 bool Orxonox::systemCommand(Command* cmd) 270 270 { 271 271 /* … … 285 285 \return a pointer to localcamera 286 286 */ 287 Camera* Orxonox::get _camera()287 Camera* Orxonox::getCamera() 288 288 { 289 289 return localcamera; … … 295 295 \return a pointer to localinput 296 296 */ 297 CommandNode* Orxonox::get _localinput()297 CommandNode* Orxonox::getLocalInput() 298 298 { 299 299 return localinput; … … 305 305 \return a pointer to world 306 306 */ 307 World* Orxonox::get _world()307 World* Orxonox::getWorld() 308 308 { 309 309 return world; … … 313 313 314 314 315 int main 315 int main(int argc, char** argv) 316 316 { 317 317 printf(">>> Starting Orxonox <<<\n"); 318 318 Orxonox *orx = Orxonox::getInstance(); 319 319 320 if( 320 if((*orx).init(argc, argv) == -1) 321 321 { 322 322 printf("! Orxonox initialization failed\n");
Note: See TracChangeset
for help on using the changeset viewer.