From 923616ccac5d84184a70ac4bd10ff35322802c8c Mon Sep 17 00:00:00 2001 From: adiblol Date: Sun, 30 Sep 2012 03:18:11 +0200 Subject: Dirty hack to allow window resizing or even full screen. Currently makes text buggy! (full screen must be initiated by window manager, for example Alt+F11 in Fluxbox) --- src/app/app.cpp | 7 +++++++ src/graphics/core/device.h | 2 +- src/graphics/opengl/gldevice.cpp | 7 +++++++ src/graphics/opengl/gldevice.h | 1 + src/ui/maindialog.cpp | 5 +++++ 5 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/app/app.cpp b/src/app/app.cpp index d6fc2dd..c703d7f 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -873,6 +873,13 @@ Event CApplication::ProcessSystemEvent() { event.type = EVENT_QUIT; } + else if ( m_private->currentEvent.type == SDL_VIDEORESIZE ) { + m_deviceConfig.size.x = m_private->currentEvent.resize.w; + m_deviceConfig.size.y = m_private->currentEvent.resize.h; + CreateVideoSurface(); + // FIXME: dirty hack, will fail with device other than OpenGL + dynamic_cast(m_device)->ResizeViewport(m_deviceConfig.size.x, m_deviceConfig.size.y); + } else if ( (m_private->currentEvent.type == SDL_KEYDOWN) || (m_private->currentEvent.type == SDL_KEYUP) ) { diff --git a/src/graphics/core/device.h b/src/graphics/core/device.h index 0777396..bd56ea3 100644 --- a/src/graphics/core/device.h +++ b/src/graphics/core/device.h @@ -72,7 +72,7 @@ struct DeviceConfig size = Math::IntPoint(800, 600); bpp = 32; fullScreen = false; - resizeable = false; + resizeable = true; doubleBuf = true; noFrame = false; } diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 78a77bd..c1c129a 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -170,6 +170,13 @@ void CGLDevice::ConfigChanged(const GLDeviceConfig& newConfig) Create(); } +void CGLDevice::ResizeViewport(const unsigned int width, const unsigned int height) +{ + m_config.size.x = width; + m_config.size.y = height; + glViewport(0, 0, m_config.size.x, m_config.size.y); +} + void CGLDevice::BeginScene() { Clear(); diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h index 8af864e..2f9b9d8 100644 --- a/src/graphics/opengl/gldevice.h +++ b/src/graphics/opengl/gldevice.h @@ -86,6 +86,7 @@ public: virtual void BeginScene(); virtual void EndScene(); + virtual void ResizeViewport(const unsigned int width, const unsigned int height); virtual void Clear(); diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 3be934a..7be7430 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -1163,6 +1163,10 @@ void CMainDialog::ChangePhase(Phase phase) if ( m_phase == PHASE_SETUPd || // setup/display ? m_phase == PHASE_SETUPds ) { + +// TODO: device settings +#if 0 + pos.x = ox+sx*3; pos.y = oy+sy*9; ddim.x = dim.x*6; @@ -1204,6 +1208,7 @@ void CMainDialog::ChangePhase(Phase phase) pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_FULL); pc->SetState(STATE_SHADOW); pc->SetState(STATE_CHECK, m_setupFull); +#endif ddim.x = dim.x*6; ddim.y = dim.y*1; -- cgit v1.2.3-1-g7c22