Changeset 4784 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 3, 2005, 4:49:42 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r4782 r4784 36 36 this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine"); 37 37 this->setName("GraphicsEngine"); 38 39 this->isInit = false; 40 38 41 this->bDisplayFPS = false; 39 42 this->minFPS = 9999; … … 42 45 this->fullscreenFlag = 0; 43 46 44 this->initVideo(); 45 46 this->listModes(); 47 // this->listModes(); 47 48 } 48 49 … … 60 61 } 61 62 63 int GraphicsEngine::init() 64 { 65 this->initVideo(640,480,16); 66 } 67 62 68 /** 63 69 \brief initializes the Video for openGL. … … 65 71 This has to be done only once when starting orxonox. 66 72 */ 67 int GraphicsEngine::initVideo() 68 { 73 int GraphicsEngine::initVideo(unsigned int resX, unsigned int resY, unsigned int bbp) 74 { 75 if (this->isInit) 76 return -1; 69 77 // initialize SDL_VIDEO 70 78 if (SDL_Init(SDL_INIT_VIDEO) == -1) … … 95 103 */ 96 104 // setting up the Resolution 97 this->setResolution( 640, 480, 16);105 this->setResolution(resX, resY, bbp); 98 106 99 107 // TO DO: Create a cool icon and use it here … … 104 112 // Enable default GL stuff 105 113 glEnable(GL_DEPTH_TEST); 114 115 this->isInit = true; 106 116 } 107 117 … … 112 122 * @returns nothing usefull 113 123 */ 114 int GraphicsEngine:: loadFromIniFile(IniParser* iniParser)124 int GraphicsEngine::initFromIniFile(IniParser* iniParser) 115 125 { 116 126 // searching for a usefull resolution 117 127 SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x'); 118 this-> setResolution(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);128 this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16); 119 129 120 130 // looking if we are in fullscreen-mode -
orxonox/trunk/src/lib/graphics/graphics_engine.h
r4782 r4784 30 30 inline static GraphicsEngine* getInstance() { if (!singletonRef) singletonRef = new GraphicsEngine(); return singletonRef; }; 31 31 32 int init Video();33 int loadFromIniFile(IniParser* iniParser);32 int init(); 33 int initFromIniFile(IniParser* iniParser); 34 34 35 35 void setWindowName(const char* windowName, const char* icon); … … 64 64 static void swapBuffers() { SDL_GL_SwapBuffers(); }; 65 65 66 public:67 static bool texturesEnabled;68 66 69 67 private: 70 68 GraphicsEngine(); 69 int initVideo(unsigned int resX, unsigned int resY, unsigned int bbp); 70 71 public: 72 static bool texturesEnabled; //!< if textures should be enabled (globally) 73 71 74 72 75 private: 73 static GraphicsEngine* singletonRef; 76 static GraphicsEngine* singletonRef; //!< Pointer to the only instance of this Class 77 bool isInit; //!< if the GraphicsEngine is initialized. 74 78 75 SDL_Surface* screen; //!< the screen we draw to76 int resolutionX; //!< the X-resoultion of the screen77 int resolutionY; //!< the Y-resolution of the screen78 int bitsPerPixel; //!< the bits per pixels of the screen79 Uint32 fullscreenFlag; //!< if we are in fullscreen mode80 Uint32 videoFlags; //!< flags for video81 SDL_Rect** videoModes; //!< list of resolutions79 SDL_Surface* screen; //!< the screen we draw to 80 int resolutionX; //!< the X-resoultion of the screen 81 int resolutionY; //!< the Y-resolution of the screen 82 int bitsPerPixel; //!< the bits per pixels of the screen 83 Uint32 fullscreenFlag; //!< if we are in fullscreen mode 84 Uint32 videoFlags; //!< flags for video 85 SDL_Rect** videoModes; //!< list of resolutions 82 86 83 bool bDisplayFPS; //!< is true if the fps should be displayed84 float currentFPS; //!< the current frame rate: frames per seconds85 float maxFPS; //!< maximal frame rate we ever got since start of the game86 float minFPS; //!< minimal frame rate we ever got since start87 bool bDisplayFPS; //!< is true if the fps should be displayed 88 float currentFPS; //!< the current frame rate: frames per seconds 89 float maxFPS; //!< maximal frame rate we ever got since start of the game 90 float minFPS; //!< minimal frame rate we ever got since start 87 91 88 92 -
orxonox/trunk/src/lib/lang/class_list.cc
r4782 r4784 89 89 } 90 90 } 91 92 91 regClass->objectList->add(objectPointer); 93 92 } -
orxonox/trunk/src/orxonox.cc
r4782 r4784 154 154 GraphicsEngine::getInstance()->setWindowName(PACKAGE_NAME " " PACKAGE_VERSION, PACKAGE_NAME " " PACKAGE_VERSION); 155 155 156 GraphicsEngine::getInstance()-> loadFromIniFile(this->iniParser);156 GraphicsEngine::getInstance()->initFromIniFile(this->iniParser); 157 157 158 158 return 0;
Note: See TracChangeset
for help on using the changeset viewer.