Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-08-23 19:27:10 +0000
committerStijn Buys <ingar@osirion.org>2008-08-23 19:27:10 +0000
commit184598a43548642b9a4bfe8c2fce58e4a966d0bb (patch)
tree636e7c977d7e93390327da3be060f9c92adefc01 /src/client/video.cc
parent37bfbfbd234cce09b67c1d53e1ef7d91a46e53cc (diff)
instant r_fullscreen switching, bound to alt+enter
Diffstat (limited to 'src/client/video.cc')
-rw-r--r--src/client/video.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/client/video.cc b/src/client/video.cc
index aed25ae..39e2c2a 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -9,7 +9,9 @@
#include "auxiliary/functions.h"
#include "client/video.h"
+#include "client/input.h"
#include "client/view.h"
+#include "client/client.h"
#include "render/camera.h"
#include "render/render.h"
#include "render/tga.h"
@@ -26,6 +28,8 @@ namespace client {
namespace video {
+float fullscreen = 0;
+
int width = 0;
int height = 0;
@@ -45,6 +49,17 @@ core::Cvar *r_fullscreen;
core::Cvar *screenshotformat;
+void restart()
+{
+ shutdown();
+
+ if (!init()) {
+ client()->quit(1);
+ }
+
+ input::reset();
+}
+
void reset()
{
// setup our viewport.
@@ -116,6 +131,7 @@ bool init()
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1);
+ fullscreen = r_fullscreen->value();
if (r_fullscreen->value()) {
flags = SDL_OPENGL | SDL_FULLSCREEN;
} else {
@@ -170,6 +186,10 @@ bool init()
void frame(float seconds)
{
+ // detect fullscreen/windowed mode switch
+ if (fullscreen != r_fullscreen->value())
+ restart();
+
// render a client frame
view::frame(seconds);