wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src titlescreen.cpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src titlescreen.cpp
Date: Fri, 03 Jun 2005 16:20:53 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/06/03 20:20:53

Modified files:
        src            : titlescreen.cpp 

Log message:
        Fix bug #11863: titlescreen background disappearing when switching to 
fullscreen. Patch from grzywacz.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/titlescreen.cpp.diff?tr1=1.41&tr2=1.42&r1=text&r2=text

Patches:
Index: wesnoth/src/titlescreen.cpp
diff -u wesnoth/src/titlescreen.cpp:1.41 wesnoth/src/titlescreen.cpp:1.42
--- wesnoth/src/titlescreen.cpp:1.41    Sat Apr  9 17:46:31 2005
+++ wesnoth/src/titlescreen.cpp Fri Jun  3 20:20:53 2005
@@ -27,18 +27,18 @@
 
 namespace {
 
-void fade_logo(display& screen, int xpos, int ypos)
+bool fade_logo(display& screen, int xpos, int ypos)
 {
        const surface 
logo(image::get_image(game_config::game_logo,image::UNSCALED));
        if(logo == NULL) {
                ERR_DP << "Could not find game logo\n";
-               return;
+               return true;
        }
 
        surface const fb = screen.video().getSurface();
 
        if(fb == NULL || xpos < 0 || ypos < 0 || xpos + logo->w > fb->w || ypos 
+ logo->h > fb->h) {
-               return;
+               return true;
        }
 
        //only once, when the game is first started, the logo fades in
@@ -75,8 +75,7 @@
                        events::pump();
                        if(screen.video().modeChanged()) {
                                faded_in = true;
-                               fade_logo(screen,xpos,ypos);
-                               return;
+                               return false;
                        }
                }
 
@@ -85,6 +84,7 @@
        LOG_DP << "logo faded in\n";
 
        faded_in = true;
+       return true;
 }
 
 const std::string& get_tip_of_day(const config& tips,int* ntip)
@@ -148,22 +148,23 @@
        const hotkey::basic_handler key_handler(&screen);
 
        const font::floating_label_context label_manager;
-       
-       const surface 
title_surface_unscaled(image::get_image(game_config::game_title,image::UNSCALED));
-       const surface 
title_surface(scale_surface(title_surface_unscaled,screen.x(),screen.y()));
-       screen.video().modeChanged(); // resets modeChanged value
-
-       if(title_surface == NULL) {
-               ERR_DP << "Could not find title image\n";
-       } else {
-               screen.video().blit_surface(0,0,title_surface);
-               update_rect(screen_area());
-
-               LOG_DP << "displayed title image\n";
-       }
-
-       
fade_logo(screen,(game_config::title_logo_x*screen.x())/1024,(game_config::title_logo_y*screen.y())/768);
 
+       // Display Wesnoth logo
+       surface const title_surface(scale_surface(
+               image::get_image(game_config::game_title,image::UNSCALED),
+               screen.x(), screen.y()));
+       screen.video().modeChanged(); // resets modeChanged value
+       int logo_x = game_config::title_logo_x * screen.x() / 1024,
+           logo_y = game_config::title_logo_y * screen.y() / 768;
+       do {
+               if (title_surface.null()) {
+                       ERR_DP << "Could not find title image\n";
+               } else {
+                       screen.video().blit_surface(0, 0, title_surface);
+                       update_rect(screen_area());
+                       LOG_DP << "displayed title image\n";
+               }
+       } while (!fade_logo(screen, logo_x, logo_y));
        LOG_DP << "faded logo\n";
 
        const std::string& version_str = _("Version") + std::string(" ") +




reply via email to

[Prev in Thread] Current Thread [Next in Thread]