Skip to content
Snippets Groups Projects
Select Git revision
  • c8bcef18acc3b453ce420554049f46201154e8ef
  • trunk
  • RELEASE_6_5_DRIVEDB
  • RELEASE_6_6_DRIVEDB
  • RELEASE_7_0_DRIVEDB
  • RELEASE_7_2_DRIVEDB
  • RELEASE_7_3_DRIVEDB
  • RELEASE_6_0_DRIVEDB
  • RELEASE_6_1_DRIVEDB
  • RELEASE_6_2_DRIVEDB
  • RELEASE_6_3_DRIVEDB
  • RELEASE_6_4_DRIVEDB
  • tags/RELEASE_7_4
  • tags/RELEASE_7_3
  • RELEASE_5_41_DRIVEDB
  • RELEASE_5_42_DRIVEDB
  • RELEASE_5_43_DRIVEDB
  • tags/RELEASE_7_2
  • tags/RELEASE_7_1
  • tags/RELEASE_7_0
  • RELEASE_5_40_DRIVEDB
21 results

os_linux.cpp

Blame
  • WindowManager.cpp 10.08 KiB
    #include "WindowManager.h"
    
    WindowManager::WindowManager()
    {
    }
    
    WindowManager::~WindowManager()
    {
    }
    
    bool WindowManager::initialize(const int width, const int height)
    {
    	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
    		cerr << "Window system could not be initalized: " << SDL_GetError() << endl;
    		return false;
    	}
    
    	atexit(SDL_Quit);
    
    	// retrieve current video settings
    	const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
    
    	if (videoInfo->current_w != 0) {
    		m_DesktopWidth = videoInfo->current_w;
    	}
    
    	if (videoInfo->current_h != 0) {
    		m_DesktopHeight = videoInfo->current_h;
    	}
    
    	if (videoInfo->vfmt->BitsPerPixel != 0) {
    		m_DesktopBitsPerPixel = videoInfo->vfmt->BitsPerPixel;
    	}
    	
    	// set initial non-fullscreen resolution
    	m_WindowedWidth = width;
    	m_WindowedHeight = height;
    
    	/*
    	 * SDL_ASYNCBLIT - Surface benutzt asynchrone Blits, wenn möglich
    	 * SDL_ANYFORMAT - Erlaubt jedes Pixel-Format (nur beim display-surface)
    	 * SDL_FULLSCREEN - Surface im Full-Screen-Mode initialisieren (nur display-surface)
    	 * SDL_OPENGL - Surface nutzt OpenGL (nur display-surface)
    	 * SDL_RESIZABLE - Surfacefenster ist veränderbar (nur display-Surface)
    	 * SDL_HWACCEL- Surface blit nutzt Hardwarebeschleunigung
    	 * SDL_SRCCOLORKEY - Surface nutzt colorkey blitting
    	 * SDL_RLEACCEL - Colorkey blitting ist durch RLE beschleunigt
    	 * SDL_SRCALPHA - Surface blit nutzt alpha blending
    	 * SDL_PREALLOC - Surface nutzt vorher allokierten Speicher
    	 */
    
    	// set common video flags
    	m_VideoModeFlags = SDL_OPENGL;
    	
    	// check fullscreen video mode
    	m_FullscreenModeAvailable = true;
    	Uint32 bitPerPixel = SDL_VideoModeOK(
    							m_DesktopWidth,
    							m_DesktopHeight,
    							m_DesktopBitsPerPixel,
    							m_VideoModeFlags | SDL_FULLSCREEN);
    
    	if(!bitPerPixel) {
    		cerr << "Fullscreen video mode not supported: " << SDL_GetError() << endl;
    		m_FullscreenModeAvailable = false;
    	}
    	
    	// check initial windowed video mode
    	m_WindowedModeAvailable = true;
    	bitPerPixel = SDL_VideoModeOK(