Changeset 288 for code/branches/main_reto_vs05
- Timestamp:
- Nov 27, 2007, 11:49:42 PM (17 years ago)
- Location:
- code/branches/main_reto_vs05
- Files:
-
- 55 added
- 3 deleted
- 15 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/main_reto_vs05/bin/Debug
- Property svn:ignore
-
old new 17 17 Ogre.log 18 18 weapon_framework.exe 19 obs_dlls
-
- Property svn:ignore
-
code/branches/main_reto_vs05/bin/Debug/Plugins.cfg
r157 r288 8 8 Plugin=RenderSystem_GL_d 9 9 Plugin=Plugin_ParticleFX_d 10 Plugin=Plugin_BSPSceneManager_d11 Plugin=Plugin_OctreeSceneManager_d12 Plugin=Plugin_CgProgramManager_d10 #Plugin=Plugin_BSPSceneManager_d 11 #Plugin=Plugin_OctreeSceneManager_d 12 #Plugin=Plugin_CgProgramManager_d 13 13 14 14 -
code/branches/main_reto_vs05/bin/Debug/resources.cfg
r159 r288 8 8 FileSystem=../../media 9 9 FileSystem=../../media/fonts 10 FileSystem=../../media/gui 10 11 FileSystem=../../media/materials/scripts 11 12 FileSystem=../../media/materials/textures 12 13 FileSystem=../../media/models 13 FileSystem=../../media/gui 14 FileSystem=../../media/overlay 15 FileSystem=../../media/particle 14 16 Zip=../../media/packs/cubemap.zip 15 17 Zip=../../media/packs/skybox.zip 18 Zip=../../media/packs/models.zip -
code/branches/main_reto_vs05/bin/Release
- Property svn:ignore
-
old new 16 16 Ogre.log 17 17 weapon_framework.exe 18 obs_dlls
-
- Property svn:ignore
-
code/branches/main_reto_vs05/bin/Release/Plugins.cfg
r157 r288 8 8 Plugin=RenderSystem_GL 9 9 Plugin=Plugin_ParticleFX 10 Plugin=Plugin_BSPSceneManager11 Plugin=Plugin_OctreeSceneManager12 Plugin=Plugin_CgProgramManager10 #Plugin=Plugin_BSPSceneManager 11 #Plugin=Plugin_OctreeSceneManager 12 #Plugin=Plugin_CgProgramManager 13 13 14 14 -
code/branches/main_reto_vs05/bin/Release/resources.cfg
r159 r288 8 8 FileSystem=../../media 9 9 FileSystem=../../media/fonts 10 FileSystem=../../media/gui 10 11 FileSystem=../../media/materials/scripts 11 12 FileSystem=../../media/materials/textures 12 13 FileSystem=../../media/models 13 FileSystem=../../media/gui 14 FileSystem=../../media/overlay 15 FileSystem=../../media/particle 14 16 Zip=../../media/packs/cubemap.zip 15 17 Zip=../../media/packs/skybox.zip 18 Zip=../../media/packs/models.zip -
code/branches/main_reto_vs05/media/materials/scripts/Ogre.material
r170 r288 118 118 } 119 119 } 120 121 122 123 material Orxonox/SuperEgg 124 { 125 technique 126 { 127 pass 128 { 129 lighting off 130 scene_blend alpha_blend 131 depth_check off 132 133 texture_unit 134 { 135 texture superegg.png 136 } 137 } 138 } 139 } 140 141 material Orxonox/Shot 142 { 143 technique 144 { 145 pass 146 { 147 lighting off 148 scene_blend alpha_blend 149 depth_check off 150 151 texture_unit 152 { 153 texture shot.png 154 } 155 } 156 } 157 } 158 159 160 material Orxonox/Red 161 { 162 technique 163 { 164 pass 165 { 166 lighting off 167 depth_check off 168 scene_blend 0.5 0.5 169 ambient 0 0 0 0.5 170 171 texture_unit 172 { 173 texture OrxonoxRED.png 174 } 175 } 176 } 177 } 178 179 180 material Orxonox/Black 181 { 182 technique 183 { 184 pass 185 { 186 lighting off 187 depth_check off 188 scene_blend 0.5 0.5 189 ambient 0 0 0 0.5 190 191 texture_unit 192 { 193 texture OrxonoxBlack.png 194 } 195 } 196 } 197 } 198 199 200 material Orxonox/BackGround 201 { 202 technique 203 { 204 pass 205 { 206 207 lighting off 208 scene_blend alpha_blend 209 depth_check off 210 texture_unit 211 { 212 texture backGround.png 213 } 214 } 215 } 216 } 217 218 material Orxonox/EnergyBackground 219 { 220 technique 221 { 222 pass 223 { 224 225 lighting off 226 scene_blend alpha_blend 227 depth_check off 228 texture_unit 229 { 230 texture EnergyBackground.png 231 } 232 } 233 } 234 } 235 236 material Orxonox/Clock 237 { 238 technique 239 { 240 pass 241 { 242 lighting off 243 scene_blend alpha_blend 244 depth_check off 245 246 texture_unit 247 { 248 texture clock.png 249 } 250 } 251 } 252 } 253 254 material Orxonox/Gun 255 { 256 technique 257 { 258 pass 259 { 260 lighting off 261 scene_blend alpha_blend 262 depth_check off 263 264 texture_unit 265 { 266 texture gun.png 267 } 268 } 269 } 270 } 271 272 material Orxonox/Man 273 { 274 technique 275 { 276 pass 277 { 278 lighting off 279 scene_blend alpha_blend 280 depth_check off 281 282 texture_unit 283 { 284 texture man.png 285 } 286 } 287 } 288 } 289 290 material Orxonox/MapBackGround 291 { 292 technique 293 { 294 pass 295 { 296 lighting off 297 scene_blend alpha_blend 298 depth_check off 299 300 texture_unit 301 { 302 texture MapBackGround.png 303 } 304 } 305 } 306 } 307 308 material Orxonox/MyShip 309 { 310 technique 311 { 312 pass 313 { 314 lighting off 315 scene_blend alpha_blend 316 depth_check off 317 318 texture_unit 319 { 320 texture MyShip.png 321 } 322 } 323 } 324 } 325 326 material Orxonox/RacketBackground 327 { 328 technique 329 { 330 pass 331 { 332 lighting off 333 scene_blend alpha_blend 334 depth_check off 335 336 texture_unit 337 { 338 texture RacketBackground.png 339 } 340 } 341 } 342 } 343 344 345 material Orxonox/TargetBackground 346 { 347 technique 348 { 349 pass 350 { 351 lighting off 352 scene_blend alpha_blend 353 depth_check off 354 355 texture_unit 356 { 357 texture TargetBackground.png 358 } 359 } 360 } 361 } 362 363 material Orxonox/PrimarBackground 364 { 365 technique 366 { 367 pass 368 { 369 lighting off 370 scene_blend alpha_blend 371 depth_check off 372 373 texture_unit 374 { 375 texture PrimarBackground.png 376 } 377 } 378 } 379 } 380 381 material Orxonox/PrimarSample 382 { 383 technique 384 { 385 pass 386 { 387 lighting off 388 scene_blend alpha_blend 389 depth_check off 390 391 texture_unit 392 { 393 texture PrimarSample.png 394 } 395 } 396 } 397 } 398 399 material Orxonox/PrimarChoice 400 { 401 technique 402 { 403 pass 404 { 405 lighting off 406 scene_blend alpha_blend 407 depth_check off 408 409 texture_unit 410 { 411 texture PrimarChoice.png 412 } 413 } 414 } 415 } 416 417 material Orxonox/RedPoint 418 { 419 technique 420 { 421 pass 422 { 423 lighting off 424 scene_blend alpha_blend 425 depth_check off 426 427 texture_unit 428 { 429 texture RedPoint.png 430 } 431 } 432 } 433 } 434 435 material Orxonox/EnergyDistrBackground 436 { 437 technique 438 { 439 pass 440 { 441 lighting off 442 scene_blend alpha_blend 443 depth_check off 444 445 texture_unit 446 { 447 texture EnergyDistrBackground.png 448 } 449 } 450 } 451 } 452 453 material Orxonox/ShildLeftTop 454 { 455 technique 456 { 457 pass 458 { 459 lighting off 460 scene_blend alpha_blend 461 depth_check off 462 463 texture_unit 464 { 465 texture ShildLeftTop.png 466 } 467 } 468 } 469 } 470 471 material Orxonox/ShildRightTop 472 { 473 technique 474 { 475 pass 476 { 477 lighting off 478 scene_blend alpha_blend 479 depth_check off 480 481 texture_unit 482 { 483 texture ShildRightTop.png 484 } 485 } 486 } 487 } 488 489 material Orxonox/ShildLeftBottom 490 { 491 technique 492 { 493 pass 494 { 495 lighting off 496 scene_blend alpha_blend 497 depth_check off 498 499 texture_unit 500 { 501 texture ShildLeftBottom.png 502 } 503 } 504 } 505 } 506 507 material Orxonox/ShildRightBottom 508 { 509 technique 510 { 511 pass 512 { 513 lighting off 514 scene_blend alpha_blend 515 depth_check off 516 517 texture_unit 518 { 519 texture ShildRightBottom.png 520 } 521 } 522 } 523 } 524 525 material Orxonox/TimeBackground 526 { 527 technique 528 { 529 pass 530 { 531 lighting off 532 scene_blend alpha_blend 533 depth_check off 534 535 texture_unit 536 { 537 texture TimeBackground.png 538 } 539 } 540 } 541 } 542 -
code/branches/main_reto_vs05/scripts/weapon_framework.vcproj
r232 r288 184 184 > 185 185 <File 186 RelativePath="..\src\camera_manager.cc"187 >188 </File>189 <File190 186 RelativePath="..\src\inertial_node.cc" 191 187 > … … 227 223 </File> 228 224 <File 229 RelativePath="..\src\weapon\base_weapon.c pp"225 RelativePath="..\src\weapon\base_weapon.cc" 230 226 > 231 227 </File> … … 280 276 <File 281 277 RelativePath="..\src\class_hierarchy\test3.cc" 278 > 279 </File> 280 </Filter> 281 <Filter 282 Name="hud" 283 > 284 <File 285 RelativePath="..\src\hud\hud_overlay.cc" 286 > 287 </File> 288 <File 289 RelativePath="..\src\hud\test_overlay.cc" 282 290 > 283 291 </File> … … 290 298 > 291 299 <File 292 RelativePath="..\src\camera_manager.h"293 >294 </File>295 <File296 300 RelativePath="..\src\inertial_node.h" 297 301 > … … 398 402 <File 399 403 RelativePath="..\src\class_hierarchy\test3.h" 404 > 405 </File> 406 </Filter> 407 <Filter 408 Name="hud" 409 > 410 <File 411 RelativePath="..\src\hud\hud_overlay.h" 412 > 413 </File> 414 <File 415 RelativePath="..\src\hud\test_overlay.h" 400 416 > 401 417 </File> -
code/branches/main_reto_vs05/src/main.cc
r232 r288 26 26 */ 27 27 28 //#define WITH_HIERARCHY 29 28 30 #include "OgrePlatform.h" 29 31 #include "OgreException.h" … … 31 33 #include "orxonox.h" 32 34 35 #ifdef WITH_HIERARCHY 33 36 #include "class_hierarchy/BaseObject.h" 34 37 #include "class_hierarchy/Test.h" … … 36 39 #include "class_hierarchy/test2.h" 37 40 #include "class_hierarchy/test3.h" 41 #endif 38 42 39 43 … … 50 54 #endif 51 55 { 52 #if 156 #ifndef WITH_HIERARCHY 53 57 try { 54 58 // create an orxonox application and run it -
code/branches/main_reto_vs05/src/orxonox.cc
r169 r288 99 99 ogre_->initialise(); 100 100 101 runMgr_ = new RunManager(ogre_); 101 runMgr_ = RunManager::createSingleton(); 102 runMgr_->initialise(ogre_); 102 103 103 104 return true; … … 113 114 delete timer_; 114 115 if (runMgr_) 115 delete runMgr_;116 RunManager::destroySingleton(); 116 117 if (ogre_) 117 118 delete ogre_; -
code/branches/main_reto_vs05/src/orxonox_prerequisites.h
r232 r288 52 52 } 53 53 54 55 namespace hud { 56 57 class HUDOverlay; 58 class TestOverlay; 59 60 } 61 54 62 } 55 63 -
code/branches/main_reto_vs05/src/orxonox_ship.cc
r232 r288 32 32 #include "OgreEntity.h" 33 33 #include "OgreSceneManager.h" 34 #include "OgreParticleSystem.h" 34 35 35 36 #include "inertial_node.h" … … 127 128 railGunStation_->selectWeapon(0); 128 129 130 // create some nice effects 131 132 ParticleSystem *particles = RunManager::getSingletonPtr() 133 ->getSceneManagerPtr()->createParticleSystem("asdf", "Examples/Smoke"); 134 135 fishNode->getSceneNode()->attachObject(particles); 136 137 138 139 129 140 return true; 130 141 } -
code/branches/main_reto_vs05/src/run_manager.cc
r232 r288 26 26 27 27 28 #include "Ogre.h" 29 //#include "OgreRoot.h" 30 //#include "OgreSceneManager.h" 31 //#include "OgreSceneNode.h" 32 //#include "OgreCamera.h" 33 //#include "OgreViewport.h" 34 //#include "OgreRenderWindow.h" 35 //#include "OgreOverlay.h" 36 //#include "OgreOverlayManager.h" 37 //#include "OgreOverlayElement.h" 38 //#include "OgreTextureManager.h" 39 //#include "OgreMaterialManager.h" 40 //#include "OgreLogManager.h" 41 //#include "OgreVector3.h" 42 //#include "OgreStringConverter.h" 43 //#include "OgreWindowEventUtilities.h" 28 #include "OgreVector3.h" 29 #include "OgreStringConverter.h" 30 #include "OgreRoot.h" 31 #include "OgreSceneManager.h" 32 #include "OgreSceneNode.h" 33 #include "OgreCamera.h" 34 #include "OgreViewport.h" 35 #include "OgreRenderWindow.h" 36 #include "OgreTextureManager.h" 37 #include "OgreMaterialManager.h" 38 #include "OgreLogManager.h" 39 #include "OgreWindowEventUtilities.h" 44 40 45 41 //Use this define to signify OIS will be used as a DLL … … 51 47 #include "orxonox_scene.h" 52 48 #include "orxonox_ship.h" 53 #include "camera_manager.h"54 49 #include "inertial_node.h" 55 50 … … 58 53 #include "weapon/base_weapon.h" 59 54 55 #include "hud/hud_overlay.h" 56 #include "hud/test_overlay.h" 57 60 58 #include "run_manager.h" 61 59 62 namespace Ogre {63 using namespace orxonox;64 template<> RunManager* Singleton<RunManager>::ms_Singleton = 0;65 }66 60 67 61 namespace orxonox { 68 62 using namespace Ogre; 69 63 using namespace weapon; 64 using namespace hud; 70 65 71 66 /** … … 82 77 */ 83 78 84 RunManager* RunManager::getSingletonPtr(void) 85 { 86 return ms_Singleton; 87 } 88 RunManager& RunManager::getSingleton(void) 89 { 90 assert( ms_Singleton ); return ( *ms_Singleton ); 91 } 92 93 94 /** 95 * Contructor only needs the render window and the Root object which are both 96 * the OgreControl object. 97 * Right now the constructor does all the initialisation work. This could also 98 * be done in a new method "initialize()", for whatever purpose. 99 * 100 * 79 80 RunManager* RunManager::singletonPtr_s = NULL; 81 82 83 /** 84 * Contructor only needs the Root object. 85 */ 86 RunManager::RunManager() 87 : ogre_(NULL), window_(NULL), screenShotCounter_(0), 88 timeUntilNextToggle_(0), mouseSensitivity_(0.003), inputManager_(0), 89 mouse_(0), keyboard_(0), joystick_(0), statsOn_(true) 90 { 91 } 92 93 /** 101 94 * @param ogre_ The OgreControl object holding the render window and the Root 102 95 */ 103 RunManager::RunManager(OgreControl * ogre) 104 : ogre_(ogre), window_(ogre->getRenderWindow()), //leftButtonDown_(false), 105 statsOn_(true), screenShotCounter_(0), timeUntilNextToggle_(0), 106 filtering_(TFO_BILINEAR), aniso_(1), sceneDetailIndex_(0), 107 mouseSensitivity_(0.003), 108 debugOverlay_(0), inputManager_(0), mouse_(0), keyboard_(0), joystick_(0) 109 { 96 void RunManager::initialise(OgreControl *ogre) 97 { 98 ogre_ = ogre; 99 window_ = ogre->getRenderWindow(); 100 110 101 // SETTING UP THE SCENE 111 102 … … 126 117 127 118 // Create a space ship object and its SceneNode. 128 // Some ideas about the steering: The ship should only receive events like129 // up, down, left, right, roll left, roll right, move down, move up, etc).130 // Multiple interpretations of these commands would make the game more131 // but it also makes AI steering more difficult, since for every type of132 // steering, new methods have to be written.133 // --> clearly define how a space ship can fly (rolling?, conservation of134 // impuls?, direct mouse sight steeering?, etc.)135 119 // It should also be considered, that the ship should provide another Node 136 120 // for a camera to be attached (otherwise the spaceship in front of the 137 // would be very static, never moving at all).121 // ship would be very static, never moving at all). 138 122 139 123 // Construct a new spaceship and give it the node … … 145 129 146 130 // load all resources and create the entities by calling the initialise() 147 // methods for each object ( don't initialise in the constructor!).131 // methods for each object (no constructor initialisations!). 148 132 backgroundScene_->initialise(); 149 133 playerShip_->initialise(); … … 151 135 152 136 // CAMERA AND VIEWPORT 153 // TODO: create a camera manager. It should be able to change its position154 // around the space ship (predefined states would be nice too). And it should155 // also be able to switch between different locations (like ship, spactator,156 // certain fixed positions (e.g. finish line, etc.)). These are just ideas.157 137 158 138 // create camera and viewport … … 160 140 createViewports(); 161 141 142 // create HUD 143 hud_ = new hud::TestOverlay(window_); 144 hud_->show(); 145 162 146 163 147 // Set default mipmap level (NB some APIs ignore this) 164 148 TextureManager::getSingleton().setDefaultNumMipmaps(5); 165 149 166 167 150 168 151 // HUMAN INTERFACE 169 152 170 using namespace OIS; 171 172 debugOverlay_ = OverlayManager::getSingleton() 173 .getByName("Core/DebugOverlay"); 153 using namespace OIS; 174 154 175 155 LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***"); … … 201 181 windowResized(window_); 202 182 203 showDebugOverlay(true);183 //showDebugOverlay(true); 204 184 205 185 // REGISTER THIS OBJECT AS A WINDOW EVENT LISTENER IN OGRE … … 225 205 if (bulletManager_) 226 206 delete bulletManager_; 227 } 228 229 230 /** 231 * Method to compute anyting between 2 frames. 207 if (hud_) 208 delete hud_; 209 } 210 211 212 /** 213 * Method to compute anything between 2 frames. 232 214 * 233 215 * Everything that needs to be computed during the games happens right here. … … 250 232 251 233 252 // Update the 'HUD' 253 updateStats(); 234 // Update the HUD 235 hud_->setDebugText(" | Speed = " 236 + StringConverter::toString(playerShip_->getSpeed()) 237 + " | Left Ammo = " 238 + StringConverter::toString(playerShip_ 239 ->getMainWeapon()->getAmmoState()) 240 + " | Ammo stock = " 241 + StringConverter::toString(playerShip_->getAmmoStock())); 242 243 hud_->tick(time, deltaTime); 254 244 255 245 // update the bullet positions … … 404 394 { 405 395 statsOn_ = !statsOn_; 406 showDebugOverlay(statsOn_);407 timeUntilNextToggle_ = 1;408 }409 410 if( keyboard_->isKeyDown(KC_T) && timeUntilNextToggle_ <= 0 )411 {412 switch(filtering_)413 {414 case TFO_BILINEAR:415 filtering_ = TFO_TRILINEAR;416 aniso_ = 1;417 break;418 case TFO_TRILINEAR:419 filtering_ = TFO_ANISOTROPIC;420 aniso_ = 8;421 break;422 case TFO_ANISOTROPIC:423 filtering_ = TFO_BILINEAR;424 aniso_ = 1;425 break;426 default: break;427 }428 MaterialManager::getSingleton().setDefaultTextureFiltering(filtering_);429 MaterialManager::getSingleton().setDefaultAnisotropy(aniso_);430 431 showDebugOverlay(statsOn_);432 396 timeUntilNextToggle_ = 1; 433 397 } … … 439 403 window_->writeContentsToFile(ss.str()); 440 404 timeUntilNextToggle_ = 0.5; 441 debugText_ = "Saved: " + ss.str(); 442 } 443 444 if(keyboard_->isKeyDown(KC_R) && timeUntilNextToggle_ <=0) 445 { 446 sceneDetailIndex_ = (sceneDetailIndex_+1)%3 ; 447 switch(sceneDetailIndex_) { 448 case 0 : camera_->setPolygonMode(PM_SOLID); break; 449 case 1 : camera_->setPolygonMode(PM_WIREFRAME); break; 450 case 2 : camera_->setPolygonMode(PM_POINTS); break; 451 } 452 timeUntilNextToggle_ = 0.5; 453 } 454 455 static bool displayCameraDetails = false; 456 if(keyboard_->isKeyDown(KC_P) && timeUntilNextToggle_ <= 0) 457 { 458 displayCameraDetails = !displayCameraDetails; 459 timeUntilNextToggle_ = 0.5; 460 if (!displayCameraDetails) 461 debugText_ = ""; 462 } 463 464 // Print camera details 465 if(displayCameraDetails) 466 debugText_ = " | Speed = " 467 + StringConverter::toString(playerShip_->getSpeed()) 468 + " | Left Ammo = " 469 + StringConverter::toString(playerShip_ 470 ->getMainWeapon()->getAmmoState()) 471 + " | Ammo stock = " 472 + StringConverter::toString(playerShip_->getAmmoStock()); 473 // debugText_ = "P: " + StringConverter::toString(camera_ 474 // ->getDerivedPosition()) + " " + "O: " 475 // + StringConverter::toString(camera_->getDerivedOrientation()); 405 } 476 406 477 407 // Return true to continue rendering … … 507 437 508 438 /** 509 * Show the debug overlay ofdesired.439 * Show an overlay desired. 510 440 * @param show Whether or not to show the debug overlay 511 441 */ 512 442 void RunManager::showDebugOverlay(bool show) 513 443 { 514 if ( debugOverlay_)444 if (hud_) 515 445 { 516 446 if (show) 517 debugOverlay_->show();447 hud_->show(); 518 448 else 519 debugOverlay_->hide(); 520 } 521 } 522 523 524 /** 525 * Show stats (e.g. FPS) in the left lower corner of the screen. 526 * Copied from the ExampleFrameListener.h in the Ogre SDK 527 */ 528 void RunManager::updateStats(void) 529 { 530 static String currFps = "Current FPS: "; 531 static String avgFps = "Average FPS: "; 532 static String bestFps = "Best FPS: "; 533 static String worstFps = "Worst FPS: "; 534 static String tris = "Triangle Count: "; 535 static String batches = "Batch Count: "; 536 537 // update stats when necessary 538 try { 539 OverlayElement* guiAvg = OverlayManager::getSingleton() 540 .getOverlayElement("Core/AverageFps"); 541 OverlayElement* guiCurr = OverlayManager::getSingleton() 542 .getOverlayElement("Core/CurrFps"); 543 OverlayElement* guiBest = OverlayManager::getSingleton() 544 .getOverlayElement("Core/BestFps"); 545 OverlayElement* guiWorst = OverlayManager::getSingleton() 546 .getOverlayElement("Core/WorstFps"); 547 548 const RenderTarget::FrameStats& stats = window_->getStatistics(); 549 guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)); 550 guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS)); 551 guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS) 552 +" "+StringConverter::toString(stats.bestFrameTime)+" ms"); 553 guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS) 554 +" "+StringConverter::toString(stats.worstFrameTime)+" ms"); 555 556 OverlayElement* guiTris = OverlayManager::getSingleton() 557 .getOverlayElement("Core/NumTris"); 558 guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount)); 559 560 OverlayElement* guiBatches = OverlayManager::getSingleton() 561 .getOverlayElement("Core/NumBatches"); 562 guiBatches->setCaption(batches 563 + StringConverter::toString(stats.batchCount)); 564 565 OverlayElement* guiDbg = OverlayManager::getSingleton() 566 .getOverlayElement("Core/DebugText"); 567 guiDbg->setCaption(debugText_); 568 } 569 catch(...) { /* ignore */ } 570 } 571 449 hud_->hide(); 450 } 451 } 572 452 573 453 574 454 /** 575 455 * Simple camera creator. 576 * playerShip_Node->attachObject(camera_) should no be here! This is what the camera577 * manager is for. Right now, this method should do just fine, setting the578 * cam behind the ship.579 */ 580 void RunManager::createCamera( void)456 * playerShip_Node->attachObject(camera_) should not be here! This is what 457 * the camera manager is for. Right now, this method should do just fine, 458 * setting the cam behind the ship. 459 */ 460 void RunManager::createCamera() 581 461 { 582 462 camera_ = sceneMgr_->createCamera("PlayerCam"); … … 589 469 /** 590 470 * Simple viewport creator. 591 * TODO: fully understand the concept of viewports concerning orxnox.592 * E.g. do we need splitscreen mode?593 471 * For now the viewport uses the entire render window and is based on the one 594 472 * camera created so far. 595 473 */ 596 void RunManager::createViewports( void)474 void RunManager::createViewports() 597 475 { 598 476 // Create one viewport, entire window … … 605 483 } 606 484 485 486 RunManager* RunManager::createSingleton() 487 { 488 if (singletonPtr_s) 489 return NULL; 490 singletonPtr_s = new RunManager(); 491 return singletonPtr_s; 492 } 493 494 void RunManager::destroySingleton() 495 { 496 if (singletonPtr_s) 497 delete singletonPtr_s; 498 } 499 500 501 RunManager& RunManager::getSingleton() 502 { 503 return *singletonPtr_s; 504 } 505 506 RunManager* RunManager::getSingletonPtr() 507 { 508 return singletonPtr_s; 509 } 510 607 511 } -
code/branches/main_reto_vs05/src/run_manager.h
r232 r288 32 32 #include "OgrePrerequisites.h" 33 33 #include "OgreWindowEventUtilities.h" 34 #include "OgreTextureManager.h" 35 #include "OgreSingleton.h" 34 //#include "OgreTextureManager.h" 36 35 37 36 #include <OIS/OISPrereqs.h> … … 44 43 // let the class inherit from WindowEventListener in order for the RunMgr 45 44 // to act as the central point of all the calcuations in Orxonox 46 class RunManager : public Ogre::WindowEventListener, 47 public Ogre::Singleton<RunManager> 45 class RunManager : public Ogre::WindowEventListener 48 46 { 49 47 public: 50 RunManager(OgreControl*);51 52 48 virtual ~RunManager(); 53 //void initialise(OgreControl*); 49 50 void initialise(OgreControl*); 54 51 55 52 bool tick(unsigned long, Ogre::Real); … … 65 62 int getNumberOfAmmos(); 66 63 64 static RunManager* createSingleton(); 65 66 static void destroySingleton(); 67 67 68 static RunManager& getSingleton(void); 68 69 … … 71 72 72 73 protected: 74 RunManager(); 75 73 76 void createCamera(void); 74 77 … … 93 96 /** OUTPUT **/ 94 97 95 void updateStats(void);96 97 98 void showDebugOverlay(bool); 98 99 99 100 protected: 101 // directly Ogre related fields 100 102 Ogre::SceneManager *sceneMgr_; 101 103 Ogre::RenderWindow *window_; 102 104 Ogre::Camera *camera_; 105 106 107 // self made orxonox fields 103 108 OgreControl *ogre_; 104 109 OrxonoxScene *backgroundScene_; 105 110 OrxonoxShip *playerShip_; 111 hud::TestOverlay *hud_; 106 112 113 // Bullet manager 114 weapon::BulletManager *bulletManager_; 115 116 const Ogre::Real mouseSensitivity_; 117 118 // previously elapsed render time 119 unsigned long totalTime_; 120 121 122 // fields from the example framework 107 123 bool statsOn_; 108 std::string debugText_;109 124 110 125 unsigned int screenShotCounter_; 111 126 // just to stop toggles flipping too fast 112 127 Ogre::Real timeUntilNextToggle_; 113 //bool leftButtonDown_;114 Ogre::TextureFilterOptions filtering_;115 int aniso_;116 117 int sceneDetailIndex_;118 Ogre::Overlay* debugOverlay_;119 128 120 129 //OIS Input devices … … 124 133 OIS::JoyStick* joystick_; 125 134 126 const Ogre::Real mouseSensitivity_; 127 128 // Bullet array 129 /*Bullet **bullets_; 130 int bulletsSize_; 131 int bulletsIndex_;*/ 132 weapon::BulletManager *bulletManager_; 133 134 // previously elapsed render time 135 unsigned long totalTime_; 135 // singleton pointer 136 static RunManager *singletonPtr_s; 136 137 137 138 }; -
code/branches/main_reto_vs05/src/weapon/barrel_gun.cc
r232 r288 95 95 void BarrelGun::primaryFiring(unsigned int time) 96 96 { 97 if (time > 1000/primaryFiringRate_)97 if (time > (unsigned int)1000/primaryFiringRate_) 98 98 { 99 99 currentState_ = IDLE; … … 133 133 void BarrelGun::secondaryFiring(unsigned int time) 134 134 { 135 if (time > 1000/secondaryFiringRate_)135 if (time > (unsigned int)1000/secondaryFiringRate_) 136 136 currentState_ = IDLE; 137 137 } -
code/branches/main_reto_vs05/src/weapon/base_weapon.cc
r232 r288 98 98 } 99 99 100 switch (currentState_)100 if (currentState_ != IDLE) 101 101 { 102 case IDLE: 102 switch (currentState_) 103 { 104 case PRIMARY_FIRE: 105 primaryFiring((unsigned int)(time - actionStartTime_)); 106 break; 107 108 case SECONDARY_FIRE: 109 secondaryFiring((unsigned int)(time - actionStartTime_)); 110 break; 111 112 case RELOADING: 113 break; 114 115 case CHANGING_AMMO: 116 break; 117 } 118 } 119 120 if (currentState_ == IDLE) 121 { 103 122 // first, process next action 104 123 if (nextAction_ != NOTHING) … … 142 161 } 143 162 } 144 145 break;146 147 case PRIMARY_FIRE:148 primaryFiring((unsigned int)(time - actionStartTime_));149 break;150 151 case SECONDARY_FIRE:152 secondaryFiring((unsigned int)(time - actionStartTime_));153 break;154 155 case RELOADING:156 break;157 158 case CHANGING_AMMO:159 break;160 163 } 161 164
Note: See TracChangeset
for help on using the changeset viewer.