Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2012-01-23 00:25:25 +0400
committerMitchell Stokes <mogurijin@gmail.com>2012-01-23 00:25:25 +0400
commit686ce92fe88d166f0fa1658363c4de8c1b5009b2 (patch)
treeb811169ce9e199a4da77f503ae9a3bed9f61683d /source/gameengine/GamePlayer
parent359e961a12e5c2f6432b8d65a543d2d6e389ba17 (diff)
Committing patch "[#27676] Change window size/resolution in realtime" by me.
Description: This patch allows the user to change the size of the window (or the resolution in fullscreen mode) using the new bge.render.setWindowSize() method. This only works in the Blenderplayer since it doesn't make a whole lot of sense for the embedded player.
Diffstat (limited to 'source/gameengine/GamePlayer')
-rw-r--r--source/gameengine/GamePlayer/common/GPC_Canvas.h1
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp20
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Canvas.h2
3 files changed, 23 insertions, 0 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h
index 6ac1323783b..a9d7ab1b93f 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.h
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h
@@ -103,6 +103,7 @@ public:
void Resize(int width, int height);
+ virtual void ResizeWindow(int width, int height){};
/**
* @section Methods inherited from abstract base class RAS_ICanvas.
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
index 4b5d2bbf96a..9b01cb5786f 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
@@ -108,6 +108,26 @@ void GPG_Canvas::SwapBuffers()
}
}
+void GPG_Canvas::ResizeWindow(int width, int height)
+{
+ if (m_window->getState() == GHOST_kWindowStateFullScreen)
+ {
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ GHOST_DisplaySetting setting;
+ setting.xPixels = width;
+ setting.yPixels = height;
+ //XXX allow these to be changed or kept from previous state
+ setting.bpp = 32;
+ setting.frequency = 60;
+
+ system->updateFullScreen(setting, &m_window);
+ }
+
+ m_window->setClientSize(width, height);
+
+ Resize(width, height);
+}
+
float GPG_Canvas::GetMouseNormalizedX(int x)
{
return float(x)/this->GetWidth();
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
index c1ebb09251c..217cfc5eb88 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
@@ -60,6 +60,8 @@ public:
virtual float GetMouseNormalizedX(int x);
virtual float GetMouseNormalizedY(int y);
+ virtual void ResizeWindow(int width, int height);
+
bool BeginDraw() { return true;};
void EndDraw() {};
};