Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4833 in orxonox.OLD for orxonox/trunk/src/lib/graphics


Ignore:
Timestamp:
Jul 11, 2005, 5:46:05 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: fight against the mighty segfault

Location:
orxonox/trunk/src/lib/graphics
Files:
2 edited

Legend:

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

    r4831 r4833  
    4545
    4646  this->fullscreenFlag = 0;
    47 
    48 //  this->listModes();
    49 
    50   // subscribe the resolutionChanged-event
    51   EventHandler::getInstance()->subscribe(this, ES_GAME, EV_VIDEO_RESIZE);
    52 
    5347}
    5448
     
    8579int GraphicsEngine::initFromIniFile(IniParser* iniParser)
    8680{
    87 
    8881  // looking if we are in fullscreen-mode
    8982  const char* fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0");
     
    10194
    10295  // searching for a usefull resolution
    103   SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x');
    104   this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
     96//  SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x');
     97  //resolution.debug();
     98
     99  //this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
     100  this->initVideo(640,480,16);
    105101}
    106102
     
    154150  glEnable(GL_DEPTH_TEST);
    155151
     152
     153  // subscribe the resolutionChanged-event
     154  //EventHandler::getInstance()->subscribe(this, ES_GAME, EV_VIDEO_RESIZE);
     155  //! @todo eventSystem craps up the Starting of orxonox -> see why.
     156
    156157  this->isInit = true;
    157158}
     
    247248
    248249/**
    249    \brief if Textures should be enabled
     250 * if Textures should be enabled
    250251*/
    251252bool GraphicsEngine::texturesEnabled = true;
    252253
     254
     255
     256/**
     257 *
     258 * @param show if The mouse-cursor should be visible
     259 */
     260void GraphicsEngine::showMouse(bool show)
     261{
     262  if (show)
     263    SDL_ShowCursor(SDL_ENABLE);
     264  else
     265    SDL_ShowCursor(SDL_DISABLE);
     266}
     267
     268/**
     269 *
     270 * @returns The Visinility of the mouse-cursor (true if visible, false if it is invisible)
     271 */
     272bool GraphicsEngine::isMouseVisible()
     273{
     274  if (SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE)
     275    return true;
     276  else
     277    return false;
     278}
     279
     280/**
     281 *
     282 * @param steal If the Winodow-Managers Events should be stolen to this app
     283 * (steals the mouse, and all WM-clicks)
     284 *
     285 * This only happens, if the HARD-Debug-level is set to 0,1,2, because otherwise a Segfault could
     286 * result in the loss of System-controll
     287 */
     288void GraphicsEngine::stealWMEvents(bool steal)
     289{
     290#if DEBUG < 3
     291   if (steal)
     292     SDL_WM_GrabInput(SDL_GRAB_ON);
     293   else SDL_WM_GrabInput(SDL_GRAB_OFF);
     294#endif
     295}
     296
     297/**
     298 *
     299 * @returns true if Events are stolen from the WM, false if not.
     300 */
     301bool GraphicsEngine::isStealingEvents()
     302{
     303   if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)
     304     return true;
     305   else
     306     return false;
     307};
    253308
    254309
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4832 r4833  
    4949    int resolutionChanged(const SDL_ResizeEvent& resizeInfo);
    5050
    51     /** @param show if The mouse-cursor should be visible */
    52     inline static void showMouse(bool show) { (show)?SDL_ShowCursor(SDL_ENABLE):SDL_ShowCursor(SDL_DISABLE); };
    53     /** @returns The Visinility of the mouse-cursor (true if visible, false if it is invisible) */
    54     static bool isMouseVisible() { return (SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE)?true:false; };
    55     /** @param steal If the Winodow-Managers Events should be stolen to this app (steals the mouse, and all WM-clicks) */
    56     static void stealWMEvents(bool steal) { (steal)?SDL_WM_GrabInput(SDL_GRAB_ON):SDL_WM_GrabInput(SDL_GRAB_OFF); };
    57     /** @returns true if Events are stolen from the WM, false if not. */
    58     static bool isStealingEvents() { if (SDL_GRAB_ON) return true; };
     51    static void showMouse(bool show);
     52    static bool isMouseVisible();
     53    static void stealWMEvents(bool steal);
     54    static bool isStealingEvents();
    5955
    6056    static void enter2DMode();
Note: See TracChangeset for help on using the changeset viewer.