Changeset 3291 for code/branches/core4/src/orxonox
- Timestamp:
- Jul 14, 2009, 11:50:47 AM (15 years ago)
- Location:
- code/branches/core4/src/orxonox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core4/src/orxonox/GraphicsManager.cc
r3290 r3291 75 75 class _OrxonoxExport OgreWindowEventListener : public Ogre::WindowEventListener 76 76 { 77 void windowResized (Ogre::RenderWindow* rw); 78 void windowFocusChange (Ogre::RenderWindow* rw); 79 void windowClosed (Ogre::RenderWindow* rw); 80 //void windowMoved (Ogre::RenderWindow* rw); 77 void windowResized (Ogre::RenderWindow* rw) 78 { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); } 79 void windowFocusChange (Ogre::RenderWindow* rw) 80 { orxonox::WindowEventListener::changeWindowFocus(); } 81 void windowClosed (Ogre::RenderWindow* rw) 82 { orxonox::Game::getInstance().stop(); } 83 void windowMoved (Ogre::RenderWindow* rw) 84 { orxonox::WindowEventListener::moveWindow(); } 81 85 }; 82 86 … … 418 422 this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg"); 419 423 } 420 421 422 /****** OgreWindowEventListener ******/423 424 void OgreWindowEventListener::windowResized(Ogre::RenderWindow* rw)425 {426 for (ObjectList<orxonox::WindowEventListener>::iterator it427 = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)428 it->windowResized(rw->getWidth(), rw->getHeight());429 }430 void OgreWindowEventListener::windowFocusChange(Ogre::RenderWindow* rw)431 {432 for (ObjectList<orxonox::WindowEventListener>::iterator it433 = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)434 it->windowFocusChanged();435 }436 void OgreWindowEventListener::windowClosed(Ogre::RenderWindow* rw)437 {438 Game::getInstance().stop();439 }440 424 } -
code/branches/core4/src/orxonox/OrxonoxPrereqs.h
r3261 r3291 92 92 class Level; 93 93 class Scene; 94 class Tickable; 94 95 95 96 class AddQuest; -
code/branches/core4/src/orxonox/gamestates/GSGraphics.cc
r3279 r3291 39 39 40 40 #include "util/Convert.h" 41 #include "core/ConfigValueIncludes.h"42 41 #include "core/Clock.h" 43 42 #include "core/CommandExecutor.h" 44 43 #include "core/ConsoleCommand.h" 45 44 #include "core/Core.h" 46 #include "core/CoreIncludes.h"47 45 #include "core/Game.h" 48 46 #include "core/GameMode.h" … … 72 70 , debugOverlay_(0) 73 71 { 74 RegisterRootObject(GSGraphics);75 72 } 76 73 77 74 GSGraphics::~GSGraphics() 78 {79 }80 81 /**82 @brief83 this function does nothing84 85 Indeed. Here goes nothing.86 */87 void GSGraphics::setConfigValues()88 75 { 89 76 } … … 108 95 GameMode::setShowsGraphics(true); 109 96 110 setConfigValues();111 112 97 // Load OGRE including the render window 113 98 this->graphicsManager_ = new GraphicsManager(); … … 124 109 125 110 // Calls the InputManager which sets up the input devices. 126 inputManager_ = new InputManager(windowHnd , renderWindow->getWidth(), renderWindow->getHeight());111 inputManager_ = new InputManager(windowHnd); 127 112 128 113 // load master key bindings … … 137 122 // Load the InGameConsole 138 123 console_ = new InGameConsole(); 139 console_->initialise( renderWindow->getWidth(), renderWindow->getHeight());124 console_->initialise(); 140 125 141 126 // load the CEGUI interface … … 233 218 this->graphicsManager_->update(time); 234 219 } 235 236 /**237 @brief238 Window has resized.239 @param rw240 The render window it occured in241 @note242 GraphicsManager has a render window stored itself. This is the same243 as rw. But we have to be careful when using multiple render windows!244 */245 void GSGraphics::windowResized(unsigned int newWidth, unsigned int newHeight)246 {247 // OIS needs this under linux even if we only use relative input measurement.248 // HACK:249 CommandExecutor::execute("setWindowExtents_s " + multi_cast<std::string>(newWidth) + " " + multi_cast<std::string>(newHeight));250 }251 252 /**253 @brief254 Window focus has changed.255 @param rw256 The render window it occured in257 */258 void GSGraphics::windowFocusChanged()259 {260 // instruct InputManager to clear the buffers (core library so we cannot use the interface)261 if (this->inputManager_)262 this->inputManager_->clearBuffers();263 }264 265 220 } -
code/branches/core4/src/orxonox/gamestates/GSGraphics.h
r3290 r3291 37 37 38 38 #include "OrxonoxPrereqs.h" 39 40 39 #include "core/GameState.h" 41 #include "core/WindowEventListener.h"42 40 43 41 namespace orxonox … … 49 47 This game state is only left out if we start a dedicated server where no graphics are present. 50 48 */ 51 class _OrxonoxExport GSGraphics : public GameState , public WindowEventListener49 class _OrxonoxExport GSGraphics : public GameState 52 50 { 53 51 public: 54 52 GSGraphics(const GameStateConstrParams& params); 55 53 ~GSGraphics(); 56 void setConfigValues();57 54 58 55 void activate(); … … 63 60 64 61 private: 65 // Window events from WindowEventListener66 void windowResized(unsigned int newWidth, unsigned int newHeight);67 void windowFocusChanged();68 69 62 // managed singletons 70 63 InputManager* inputManager_; //!< Reference to input management -
code/branches/core4/src/orxonox/overlays/OrxonoxOverlay.cc
r3265 r3291 47 47 #include "core/XMLPort.h" 48 48 #include "core/ConsoleCommand.h" 49 #include "GraphicsManager.h"50 49 51 50 namespace orxonox … … 81 80 82 81 // Get aspect ratio from the render window. Later on, we get informed automatically 83 Ogre::RenderWindow* defaultWindow = GraphicsManager::getInstance().getRenderWindow(); 84 this->windowAspectRatio_ = (float)defaultWindow->getWidth() / defaultWindow->getHeight(); 82 this->windowAspectRatio_ = (float)this->getWindowWidth() / this->getWindowHeight(); 85 83 this->sizeCorrectionChanged(); 86 84 -
code/branches/core4/src/orxonox/overlays/console/InGameConsole.cc
r3279 r3291 172 172 @brief Initializes the InGameConsole. 173 173 */ 174 void InGameConsole::initialise( int windowWidth, int windowHeight)174 void InGameConsole::initialise() 175 175 { 176 176 // create the corresponding input state … … 248 248 this->consoleOverlayContainer_->addChild(this->consoleOverlayNoise_); 249 249 250 this->windowResized( windowWidth, windowHeight);250 this->windowResized(this->getWindowWidth(), this->getWindowWidth()); 251 251 252 252 // move overlay "above" the top edge of the screen -
code/branches/core4/src/orxonox/overlays/console/InGameConsole.h
r3290 r3291 46 46 ~InGameConsole(); 47 47 48 void initialise( int windowWidth, int windowHeight);48 void initialise(); 49 49 void destroy(); 50 50 void setConfigValues();
Note: See TracChangeset
for help on using the changeset viewer.