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-02-05 20:44:36 +0000
committerStijn Buys <ingar@osirion.org>2008-02-05 20:44:36 +0000
commita51deebd87036ceb87c77a20117977d077b771e3 (patch)
tree71217d051fe77b562cd92508fe9edb3da6b7cc7a /src/client/video.cc
parent8ee5d47d7e1336eb69064ca31e27bbfa7d86b51e (diff)
fixed cvar, added cvars r_width r_height r_fullscreen, added function r_restart
Diffstat (limited to 'src/client/video.cc')
-rw-r--r--src/client/video.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/client/video.cc b/src/client/video.cc
index bb748d0..df11b90 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -7,6 +7,7 @@
#include "client/video.h"
#include "client/view.h"
#include "render/render.h"
+#include "core/core.h"
#include "sys/sys.h"
#include <SDL/SDL.h>
@@ -24,6 +25,12 @@ int width = 0;
int height = 0;
float aspect = 1;
+//--- cvars -------------------------------------------------------
+
+core::Cvar r_width;
+core::Cvar r_height;
+core::Cvar r_fullscreen;
+
void reset()
{
// recalculate the video aspect
@@ -40,10 +47,15 @@ bool init()
{
con_print << "Initializing video..." << std::endl;
+ // initialize cvars
+ r_width = core::cvar::get("r_width", defaultwidth);
+ r_height = core::cvar::get("r_height", defaultheight);
+ r_fullscreen = core::cvar::get("r_fullscreen", 1);
+
int bpp = 0;
int flags = 0;
- if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+ if( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 ) {
std::cerr << "SDL_Init() failed: " << SDL_GetError() << std::endl;
return false;
}
@@ -72,10 +84,13 @@ bool init()
return false;
}
- aspect = (float) width / (float) height;
con_print << " video mode " << width << "x" << height << "x" << bpp << "bpp" << std::endl;
+
+ aspect = (float) width / (float) height;
+
render::init();
+
view::init();
video::reset();
@@ -96,10 +111,13 @@ void shutdown()
con_print << "Shutting down video..." << std::endl;
view::shutdown();
+
render::shutdown();
width = 0;
height = 0;
+
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
} // namespace video