Author: grzywacz
Date: Mon Jul 14 23:22:36 2008
New Revision: 28036

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28036&view=rev
Log:
First step towards removing video init code from game_controller. Disregard the 
FIXME's - for my reference only.

Modified:
    trunk/src/game.cpp

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=28036&r1=28035&r2=28036&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Mon Jul 14 23:22:36 2008
@@ -169,6 +169,7 @@
        void delete_addon(const std::string& addon, network::connection sock);
        void remove_addon(const std::string& addon);
        bool addon_dependencies_met(const std::vector<std::string>& deplist);
+       bool detect_video_settings(); // FIXME
 
        const int argc_;
        int arg_;
@@ -202,6 +203,10 @@
        util::scoped_ptr<game_display> disp_;
 
        game_state state_;
+
+       std::pair<int,int> resolution; // FIXME
+       int bpp; // FIXME
+       int video_flags; // FIXME
 
        std::string loaded_game_;
        bool loaded_game_show_replay_;
@@ -392,23 +397,10 @@
        return *disp_.get();
 }
 
-bool game_controller::init_video()
-{
-       if(no_gui_) {
-               if(!multiplayer_mode_) {
-                       std::cerr << "--nogui flag is only valid with 
--multiplayer flag\n";
-                       return false;
-               }
-               video_.make_fake();
-               game_config::no_delay = true;
-               return true;
-       }
-
-       image::set_wm_icon();
-
-       int video_flags = preferences::fullscreen() ? FULL_SCREEN : 0;
-
-       std::pair<int,int> resolution = preferences::resolution();
+bool game_controller::detect_video_settings() 
+{
+       video_flags = preferences::fullscreen() ? FULL_SCREEN : 0;
+       resolution  = preferences::resolution();
 
        int DefaultBPP = 24;
        const SDL_VideoInfo* const video_info = SDL_GetVideoInfo();
@@ -418,7 +410,7 @@
 
        std::cerr << "Checking video mode: " << resolution.first
                  << "x" << resolution.second << "x" << DefaultBPP << "...\n";
-       int bpp = 
video_.modePossible(resolution.first,resolution.second,DefaultBPP,video_flags);
+       bpp = 
video_.modePossible(resolution.first,resolution.second,DefaultBPP,video_flags);
 
        if(bpp == 0) {
                //Video mode not supported, maybe from bad prefs.
@@ -492,6 +484,28 @@
 
        if(force_bpp_ > 0) {
                bpp = force_bpp_;
+       }
+
+       return true;
+}
+
+bool game_controller::init_video()
+{
+       if(no_gui_) {
+               if(!multiplayer_mode_) {
+                       std::cerr << "--nogui flag is only valid with 
--multiplayer flag\n";
+                       return false;
+               }
+               video_.make_fake();
+               game_config::no_delay = true;
+               return true;
+       }
+
+       image::set_wm_icon();
+
+       bool found_matching = detect_video_settings();
+       if(!found_matching) {
+               return false;
        }
 
        std::cerr << "setting mode to " << resolution.first << "x" << 
resolution.second << "x" << bpp << "\n";


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to