Author: ai0867
Date: Thu Sep 18 10:18:01 2008
New Revision: 29530
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29530&view=rev
Log:
Adress bug #10738 (Add 'scale_background' key to [story])
Modified:
trunk/data/scenario-test.cfg
trunk/src/intro.cpp
Modified: trunk/data/scenario-test.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=29530&r1=29529&r2=29530&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Thu Sep 18 10:18:01 2008
@@ -36,7 +36,18 @@
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}
-
+ [story]
+ [part]
+ background="attacks/hammer-dwarven-runic.png"
+ story= _"scaled"
+ scale_background=yes
+ [/part]
+ [part]
+ background="attacks/hammer-dwarven-runic.png"
+ story= _"unscaled"
+ scale_background=no
+ [/part]
+ [/story]
[music]
name="traveling_minstrels.ogg"
ms_before=12000
Modified: trunk/src/intro.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/intro.cpp?rev=29530&r1=29529&r2=29530&view=diff
==============================================================================
--- trunk/src/intro.cpp (original)
+++ trunk/src/intro.cpp Thu Sep 18 10:18:01 2008
@@ -111,6 +111,7 @@
const std::string& background_name = part["background"];
const bool show_title = utils::string_bool(part["show_title"]);
+ const bool scale_background = part["scale_background"].empty() ? true :
utils::string_bool(part["scale_background"]);
surface background(NULL);
if(background_name.empty() == false) {
@@ -126,8 +127,8 @@
background.assign(create_neutral_surface(video.getx(),video.gety()));
}
- double xscale = 1.0 * video.getx() / background->w;
- double yscale = 1.0 * video.gety() / background->h;
+ double xscale = scale_background ? 1.0 * video.getx() / background->w :
1.0;
+ double yscale = scale_background ? 1.0 * video.gety() / background->h :
1.0;
double scale = std::min<double>(xscale,yscale);
background = scale_surface(background,
static_cast<int>(background->w*scale), static_cast<int>(background->h*scale));
@@ -142,11 +143,12 @@
#ifdef USE_TINY_GUI
textx = 10;
int xbuttons = video.getx() - 50;
+ int ybuttons = dstrect.y + dstrect.h - 20;
// Use the whole screen for text
texty = 0;
#else
- int xbuttons;
+ int xbuttons, ybuttons;
if (background->w > 500) {
textx = dstrect.x + 150;
@@ -156,7 +158,13 @@
xbuttons = video.getx() - 200 - 40;
}
- texty = dstrect.y + dstrect.h - 200;
+ if (background->h > 375) {
+ texty = dstrect.y + dstrect.h - 200;
+ ybuttons = dstrect.y + dstrect.h - 40;
+ } else {
+ texty = video.gety() - 200;
+ ybuttons = video.gety() - 40;
+ }
#endif
// Darken the area for the text and buttons to be drawn on
@@ -165,11 +173,11 @@
}
#ifdef USE_TINY_GUI
- next_button.set_location(xbuttons,dstrect.y+dstrect.h-40);
- skip_button.set_location(xbuttons,dstrect.y+dstrect.h-20);
+ next_button.set_location(xbuttons,ybuttons-20);
+ skip_button.set_location(xbuttons,ybuttons);
#else
- next_button.set_location(xbuttons,dstrect.y+dstrect.h-70);
- skip_button.set_location(xbuttons,dstrect.y+dstrect.h-40);
+ next_button.set_location(xbuttons,ybuttons-30);
+ skip_button.set_location(xbuttons,ybuttons);
#endif
// Draw title if needed
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits