Welcome, Guest! Log In | Create Account

Changeset 1675

Show
Ignore:
Timestamp:
06/30/09 11:41:10 (4 months ago)
Author:
borrillis
Message:

Ticket #51
- Minor modifications to SDL Fullscreen handling

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Projects/Axiom/Source/RenderSystems/OpenGL/SDL/SdlWindow.cs

    r1663 r1675  
    218218                public void Show() 
    219219                { 
     220            if ( FullScreen ) 
     221            { 
     222                this.SavePreviousWindowSettings(); 
     223            } 
    220224                        InitializeWindow(); 
    221225                } 
     
    242246                        if ( FullScreen ) 
    243247                        { 
    244                                 flags |= Sdl.SDL_FULLSCREEN; 
    245                                  
    246                                 // remember previous window settings for when we destroy it 
    247                                 IntPtr info = Sdl.SDL_GetVideoInfo(); 
    248                                 Sdl.SDL_VideoInfo videoInfo = (Sdl.SDL_VideoInfo) Marshal.PtrToStructure(info, typeof(Sdl.SDL_VideoInfo)); 
    249                                 Sdl.SDL_PixelFormat vfmt = (Sdl.SDL_PixelFormat) Marshal.PtrToStructure(videoInfo.vfmt, typeof(Sdl.SDL_PixelFormat)); 
    250                                  
    251                                 _previousWidth = videoInfo.current_w; 
    252                                 _previousHeight = videoInfo.current_h; 
    253                                 _previousColorDepth = vfmt.BitsPerPixel; 
    254                         } 
    255  
    256                         // set the video mode (and create the surface) 
     248                            flags |= Sdl.SDL_FULLSCREEN; 
     249                        } 
     250 
     251                    // set the video mode (and create the surface) 
    257252                        // TODO: Grab return val once changed to the right type 
    258253                        SdlWindow._hWindow = Sdl.SDL_SetVideoMode( Width, Height, ColorDepth, flags ); 
    259254 
    260255                        if ( _hWindow == IntPtr.Zero ) 
    261                                 throw new Exception( "Failed to create SDL window :" + Sdl.SDL_GetError() ); 
    262  
    263                 } 
    264  
    265                 internal void WndProc() 
     256                                throw new Exception( String.Format( "SDL: failed to set video mode to {0}x{1}, color depth: {2}./n{3}",  Width, Height, ColorDepth, Sdl.SDL_GetError() ) ); 
     257 
     258                } 
     259 
     260            private void SavePreviousWindowSettings() 
     261            { 
     262                IntPtr info = Sdl.SDL_GetVideoInfo(); 
     263                Sdl.SDL_VideoInfo videoInfo = (Sdl.SDL_VideoInfo) Marshal.PtrToStructure(info, typeof(Sdl.SDL_VideoInfo)); 
     264                Sdl.SDL_PixelFormat vfmt = (Sdl.SDL_PixelFormat) Marshal.PtrToStructure(videoInfo.vfmt, typeof(Sdl.SDL_PixelFormat)); 
     265                                 
     266                this._previousWidth = videoInfo.current_w; 
     267                this._previousHeight = videoInfo.current_h; 
     268                this._previousColorDepth = vfmt.BitsPerPixel; 
     269            } 
     270 
     271            internal void WndProc() 
    266272                { 
    267273            Sdl.SDL_Event sdlEvent;