Select Git revision
short_transient_search_gridded.py
Forked from
Gregory Ashton / PyFstat
Source project has a limited visibility.
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(