Add a revision label the the new title screen.

This commit is contained in:
Mark de Wever 2010-04-05 13:36:03 +00:00
parent d74c4c90ae
commit 599b504f65
3 changed files with 143 additions and 15 deletions

View file

@ -0,0 +1,114 @@
#textdomain wesnoth-lib
###
### Definition of a label.
###
### Defines the following revision label for the title screen.
#define _GUI_RESOLUTION RESOLUTION FONT_SIZE FONT_COLOUR_ENABLED FONT_COLOUR_DISABLED Y_POSITION
[resolution]
{RESOLUTION}
min_width = 0
min_height = 0
default_width = 0
default_height = 0
max_width = 0
max_height = 0
text_font_size = {FONT_SIZE}
[state_enabled]
[draw]
[image]
x = 0
y = 0
w = "(width)"
h = "(height)"
name = "dialogs/translucent-background_80.png"
resize_mode = "tile"
[/image]
[text]
x = 0
y = 0
w = "(width)"
h = "(height)"
maximum_width = "(width)"
font_size = {FONT_SIZE}
text_alignment = "(text_alignment)"
colour = {FONT_COLOUR_ENABLED}
text = "(text)"
text_markup = "(text_markup)"
[/text]
[/draw]
[/state_enabled]
[state_disabled]
[draw]
[image]
x = 0
y = 0
w = "(width)"
h = "(height)"
name = "dialogs/translucent-background_80.png"
resize_mode = "tile"
[/image]
[text]
x = 0
y = 0
w = "(width)"
h = "(height)"
maximum_width = "(width)"
font_size = {FONT_SIZE}
text_alignment = "(text_alignment)"
colour = {FONT_COLOUR_DISABLED}
text = "(text)"
text_markup = "(text_markup)"
[/text]
[/draw]
[/state_disabled]
[/resolution]
#enddef
#define _GUI_DEFINITION ID DESCRIPTION FONT_SIZE FONT_COLOUR Y_POSITION
[label_definition]
id = {ID}
description = {DESCRIPTION}
{_GUI_RESOLUTION
({GUI_TINY__RESOLUTION})
({GUI_TINY__FONT_SIZE__{FONT_SIZE}})
({GUI__FONT_COLOUR_ENABLED__{FONT_COLOUR}})
({GUI__FONT_COLOUR_DISABLED__{FONT_COLOUR}})
({Y_POSITION})
}
{_GUI_RESOLUTION
({GUI_NORMAL__RESOLUTION})
({GUI_NORMAL__FONT_SIZE__{FONT_SIZE}})
({GUI__FONT_COLOUR_ENABLED__{FONT_COLOUR}})
({GUI__FONT_COLOUR_DISABLED__{FONT_COLOUR}})
({Y_POSITION})
}
[/label_definition]
#enddef
{_GUI_DEFINITION "title_creen_revision" "label used for the revision number in the title screen" SMALL DEFAULT ({GUI__TEXT_VERTICALLY_CENTRED})}
#undef _GUI_DEFINITION
#undef _GUI_RESOLUTION

View file

@ -22,16 +22,6 @@
name = "(background_image)"
[/image]
[text]
x = 0
y = "(height - text_height)"
w = "(text_width)"
h = "(text_height)"
font_size = 16
font_colour = "255, 255, 255, 128"
text = "(revision_number)"
[/text]
[/draw]
[/background]
@ -302,6 +292,7 @@
[layer]
[row]
grow_factor = 1
{_GUI_H_SPACER}
@ -333,6 +324,26 @@
[/row]
[row]
{_GUI_H_SPACER}
[column]
horizontal_alignment = "left"
[label]
id = "revision_number"
definition = "title_creen_revision"
[/label]
[/column]
{_GUI_V_SPACER}
{_GUI_V_SPACER}
{_GUI_H_SPACER}
[/row]
[/layer]
[/stack]
@ -343,11 +354,6 @@
[/row]
[row]
{_GUI_V_SPACER}
[/row]
[/grid]

View file

@ -84,6 +84,8 @@ void show_language_dialog(CVideo& video, twindow& window)
* (next_tip) (button) () The button show the next tip of day.
* (previous_tip) (button) () The button show the previous tip of day.
* (logo) (progress_bar) () A progress bar to "animate" the image
* (revision_number) (control)
* A widget to show the version number.
* @end_table
*/
@ -137,6 +139,12 @@ void ttitle_screen::pre_show(CVideo& video, twindow& window)
window.set_click_dismiss(false);
window.set_escape_disabled(true);
/**** Set the version number ****/
if(tcontrol* control
= find_widget<tcontrol>(&window, "revision_number", false, false)) {
control->set_label(_("Version ") + game_config::revision);
}
window.canvas()[0].set_variable("revision_number",
variant(_("Version") + std::string(" ") + game_config::revision));