summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoradiblol <adiblol@hydrogen>2012-09-30 03:18:11 +0200
committeradiblol <adiblol@hydrogen>2012-09-30 03:18:11 +0200
commit923616ccac5d84184a70ac4bd10ff35322802c8c (patch)
treec6bb91cc1839810c351c0739658ef10eba0181f7 /src
parentc36d0c8ed24775babd875e5f1ff7083e85fb2191 (diff)
downloadcolobot-923616ccac5d84184a70ac4bd10ff35322802c8c.tar.gz
colobot-923616ccac5d84184a70ac4bd10ff35322802c8c.tar.bz2
colobot-923616ccac5d84184a70ac4bd10ff35322802c8c.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/app/app.cpp7
-rw-r--r--src/graphics/core/device.h2
-rw-r--r--src/graphics/opengl/gldevice.cpp7
-rw-r--r--src/graphics/opengl/gldevice.h1
-rw-r--r--src/ui/maindialog.cpp5
5 files changed, 21 insertions, 1 deletions
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<Gfx::CGLDevice*>(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;