Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4784 in orxonox.OLD


Ignore:
Timestamp:
Jul 3, 2005, 4:49:42 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: setting the resolution works again (workaround. now i fix the subprojects again.)

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4782 r4784  
    3636  this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");
    3737  this->setName("GraphicsEngine");
     38
     39  this->isInit = false;
     40
    3841  this->bDisplayFPS = false;
    3942  this->minFPS = 9999;
     
    4245  this->fullscreenFlag = 0;
    4346
    44   this->initVideo();
    45 
    46   this->listModes();
     47//  this->listModes();
    4748}
    4849
     
    6061}
    6162
     63int GraphicsEngine::init()
     64{
     65  this->initVideo(640,480,16);
     66}
     67
    6268/**
    6369   \brief initializes the Video for openGL.
     
    6571   This has to be done only once when starting orxonox.
    6672*/
    67 int GraphicsEngine::initVideo()
    68 {
     73int GraphicsEngine::initVideo(unsigned int resX, unsigned int resY, unsigned int bbp)
     74{
     75  if (this->isInit)
     76    return -1;
    6977  // initialize SDL_VIDEO
    7078  if (SDL_Init(SDL_INIT_VIDEO) == -1)
     
    95103  */
    96104    // setting up the Resolution
    97   this->setResolution(640, 480, 16);
     105  this->setResolution(resX, resY, bbp);
    98106
    99107  // TO DO: Create a cool icon and use it here
     
    104112  // Enable default GL stuff
    105113  glEnable(GL_DEPTH_TEST);
     114
     115  this->isInit = true;
    106116}
    107117
     
    112122 * @returns nothing usefull
    113123 */
    114 int GraphicsEngine::loadFromIniFile(IniParser* iniParser)
     124int GraphicsEngine::initFromIniFile(IniParser* iniParser)
    115125{
    116126  // searching for a usefull resolution
    117127  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);
    119129
    120130  // looking if we are in fullscreen-mode
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4782 r4784  
    3030    inline static GraphicsEngine* getInstance() { if (!singletonRef) singletonRef = new GraphicsEngine();  return singletonRef; };
    3131
    32     int initVideo();
    33     int loadFromIniFile(IniParser* iniParser);
     32    int init();
     33    int initFromIniFile(IniParser* iniParser);
    3434
    3535    void setWindowName(const char* windowName, const char* icon);
     
    6464    static void swapBuffers() { SDL_GL_SwapBuffers(); };
    6565
    66   public:
    67     static bool texturesEnabled;
    6866
    6967  private:
    7068    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
    7174
    7275  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.
    7478
    75     SDL_Surface*   screen;          //!< the screen we draw to
    76     int            resolutionX;     //!< the X-resoultion of the screen
    77     int            resolutionY;     //!< the Y-resolution of the screen
    78     int            bitsPerPixel;    //!< the bits per pixels of the screen
    79     Uint32         fullscreenFlag;  //!< if we are in fullscreen mode
    80     Uint32         videoFlags;      //!< flags for video
    81     SDL_Rect**     videoModes;      //!< list of resolutions
     79    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
    8286
    83     bool           bDisplayFPS;     //!< is true if the fps should be displayed
    84     float          currentFPS;      //!< the current frame rate: frames per seconds
    85     float          maxFPS;          //!< maximal frame rate we ever got since start of the game
    86     float          minFPS;          //!< minimal frame rate we ever got since start
     87    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
    8791
    8892
  • orxonox/trunk/src/lib/lang/class_list.cc

    r4782 r4784  
    8989    }
    9090  }
    91 
    9291  regClass->objectList->add(objectPointer);
    9392}
  • orxonox/trunk/src/orxonox.cc

    r4782 r4784  
    154154  GraphicsEngine::getInstance()->setWindowName(PACKAGE_NAME " " PACKAGE_VERSION, PACKAGE_NAME " " PACKAGE_VERSION);
    155155
    156   GraphicsEngine::getInstance()->loadFromIniFile(this->iniParser);
     156  GraphicsEngine::getInstance()->initFromIniFile(this->iniParser);
    157157
    158158  return 0;
Note: See TracChangeset for help on using the changeset viewer.