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/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