mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 22:17:00 +00:00
GUI2/Unit Preview Pane: used NN-scaled [drawing] for unit image (resolves #6700)
This commit is contained in:
parent
1cc222caec
commit
cdd854d5fa
@ -1,5 +1,27 @@
|
||||
#textdomain wesnoth-lib
|
||||
|
||||
#define _GUI_UNIT_PREVIEW_PANE_TYPE_DRAWING
|
||||
[drawing]
|
||||
id = "type_image"
|
||||
definition = "default"
|
||||
|
||||
width = 144
|
||||
height = 144
|
||||
|
||||
[draw]
|
||||
|
||||
[image]
|
||||
name = "(text)"
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
resize_mode = "scale_sharp"
|
||||
[/image]
|
||||
|
||||
[/draw]
|
||||
|
||||
[/drawing]
|
||||
#enddef
|
||||
|
||||
#define _GUI_UNIT_PREVIEW_PANE_FULL
|
||||
[grid]
|
||||
|
||||
@ -9,13 +31,10 @@
|
||||
[column]
|
||||
border = "bottom"
|
||||
border_size = 5
|
||||
horizontal_grow = true
|
||||
horizontal_alignment = "left"
|
||||
vertical_alignment = "center"
|
||||
|
||||
[image]
|
||||
id = "type_image"
|
||||
definition = "default"
|
||||
[/image]
|
||||
{_GUI_UNIT_PREVIEW_PANE_TYPE_DRAWING}
|
||||
|
||||
[/column]
|
||||
|
||||
@ -299,9 +318,7 @@
|
||||
border = "right"
|
||||
border_size = 5
|
||||
|
||||
[image]
|
||||
id = "type_image"
|
||||
[/image]
|
||||
{_GUI_UNIT_PREVIEW_PANE_TYPE_DRAWING}
|
||||
|
||||
[/column]
|
||||
|
||||
@ -419,9 +436,7 @@
|
||||
border = "left"
|
||||
border_size = 5
|
||||
|
||||
[image]
|
||||
id = "type_image"
|
||||
[/image]
|
||||
{_GUI_UNIT_PREVIEW_PANE_TYPE_DRAWING}
|
||||
|
||||
[/column]
|
||||
|
||||
@ -487,4 +502,5 @@
|
||||
#undef _GUI_UNIT_PREVIEW_PANE_FULL
|
||||
#undef _GUI_UNIT_PREVIEW_PANE_MINIMAL_LEFT
|
||||
#undef _GUI_UNIT_PREVIEW_PANE_MINIMAL_RIGHT
|
||||
#undef _GUI_UNIT_PREVIEW_PANE_TYPE_DRAWING
|
||||
#undef _GUI_RESOLUTION
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "gui/core/register_widget.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/drawing.hpp"
|
||||
#include "gui/widgets/image.hpp"
|
||||
#include "gui/widgets/label.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
@ -73,7 +74,7 @@ unit_preview_pane::unit_preview_pane(const implementation::builder_unit_preview_
|
||||
void unit_preview_pane::finalize_setup()
|
||||
{
|
||||
// Icons
|
||||
icon_type_ = find_widget<image>(this, "type_image", false, false);
|
||||
icon_type_ = find_widget<drawing>(this, "type_image", false, false);
|
||||
icon_race_ = find_widget<image>(this, "type_race", false, false);
|
||||
icon_alignment_ = find_widget<image>(this, "type_alignment", false, false);
|
||||
|
||||
@ -281,7 +282,7 @@ void unit_preview_pane::set_displayed_type(const unit_type& type)
|
||||
+ ")";
|
||||
}
|
||||
|
||||
mods += "~XBRZ(2)~SCALE_INTO_SHARP(144,144)" + image_mods_;
|
||||
mods += image_mods_;
|
||||
|
||||
icon_type_->set_label((type.icon().empty() ? type.image() : type.icon()) + mods);
|
||||
}
|
||||
@ -426,7 +427,7 @@ void unit_preview_pane::set_displayed_unit(const unit& u)
|
||||
mods += "~BLIT(" + overlay + ")";
|
||||
}
|
||||
|
||||
mods += "~XBRZ(2)~SCALE_INTO_SHARP(144,144)" + image_mods_;
|
||||
mods += image_mods_;
|
||||
|
||||
icon_type_->set_label(u.absolute_image() + mods);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace gui2
|
||||
// ------------ WIDGET -----------{
|
||||
|
||||
class button;
|
||||
class drawing;
|
||||
class image;
|
||||
class label;
|
||||
class tree_view;
|
||||
@ -77,7 +78,7 @@ protected:
|
||||
private:
|
||||
utils::optional_reference<const unit_type> current_type_;
|
||||
|
||||
image* icon_type_;
|
||||
drawing* icon_type_;
|
||||
image* icon_race_;
|
||||
image* icon_alignment_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user