Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/video.cc40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/client/video.cc b/src/client/video.cc
index 330ba6b..72b72da 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -28,6 +28,8 @@ namespace client
core::Cvar *r_width = 0;
core::Cvar *r_height = 0;
+core::Cvar *r_windowwidth = 0;
+core::Cvar *r_windowheight = 0;
core::Cvar *r_fullscreen = 0;
core::Cvar *draw_ui = 0;
@@ -49,6 +51,7 @@ int height = 0;
int width_prev = 0;
int height_prev = 0;
+// default resolution and window size
const int width_default = 1024;
const int height_default = 768;
@@ -66,6 +69,12 @@ bool init()
r_height = core::Cvar::get("r_height", height_default, core::Cvar::Archive);
r_height->set_info("[int] video resolution height");
+ r_windowwidth = core::Cvar::get("r_windowwidth", width_default, core::Cvar::Archive);
+ r_windowwidth->set_info("[int] window width in windowed mode");
+
+ r_windowheight = core::Cvar::get("r_windowheight", height_default, core::Cvar::Archive);
+ r_windowheight->set_info("[int] window height in windowed mode");
+
r_fullscreen = core::Cvar::get("r_fullscreen", "0", core::Cvar::Archive);
r_fullscreen->set_info("[bool] enable or disable fullscreen video");
@@ -114,13 +123,7 @@ bool init()
return false;
}
- width_prev = width;
- height_prev = height;
- width = (int) r_width->value();
- height = (int) r_height->value();
-
bpp = sdl_videoinfo->vfmt->BitsPerPixel;
-
if (bpp == 32) {
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
@@ -142,10 +145,22 @@ bool init()
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+
+ width_prev = width;
+ height_prev = height;
+
+ width = (int) r_width->value();
+ height = (int) r_height->value();
+
fullscreen = r_fullscreen->value();
+
if (r_fullscreen->value()) {
flags = SDL_OPENGL | SDL_FULLSCREEN;
} else {
+ if (r_windowwidth->value() && r_windowheight->value()) {
+ width = (int) r_windowwidth->value();
+ height = (int) r_windowheight->value();
+ }
flags = SDL_OPENGL;
#ifndef _WIN32
flags |= SDL_RESIZABLE;
@@ -183,10 +198,15 @@ bool init()
// set window caption
set_caption();
- // save r_width and r_height variables
- (*r_width) = width;
- (*r_height) = height;
-
+ // save window width and height
+ if (fullscreen) {
+ (*r_width) = width;
+ (*r_height) = height;
+ } else {
+ (*r_windowwidth) = width;
+ (*r_windowheight) = height;
+
+ }
// resize user interface
ui::root()->set_size((float) width, (float) height);
ui::root()->event_resize();