25 #include "eng3d/ui/components.hpp"
26 #include "eng3d/string.hpp"
34 :
UI::Window(-400, -400, 800, 800),
49 auto& flag_img = this->make_widget<UI::AspectImage>(0, 0, 128, 96, this->gs.
get_nation_flag(this->nation));
50 flag_img.set_on_each_tick([
this](
UI::Widget& w) {
53 flag_img.on_each_tick(flag_img);
55 auto& flex_actions_column = this->make_widget<UI::Div>(0, 0, 128, this->
height);
56 flex_actions_column.below_of(flag_img);
59 auto& name_lab = flex_actions_column.make_widget<
UI::Label>(0, 0,
"?");
63 name_lab.on_each_tick(name_lab);
65 auto& ideology_img = this->make_widget<UI::Image>(0, 0, 24, 24);
66 ideology_img.set_on_each_tick([
this](
UI::Widget& w) {
69 w.set_tooltip(ideology.ref_name);
71 ideology_img.on_each_tick(ideology_img);
74 auto& rel_lab = flex_actions_column.make_widget<
UI::Label>(0, 0,
"?");
79 std::string text =
translate(
"Our diplomatic relations with them and our alliance:\n");
80 text += (relation.is_customs_union() ?
translate(
"- In customs union") :
translate(
"- Not in a customs union")) +
"\n";
81 text += (relation.is_allied() ?
translate(
"- Allied") :
translate(
"- Not allied")) +
"\n";
83 text += (relation.has_landpass() ?
translate(
"- Land access") :
translate(
"- No land access")) +
"\n";
86 rel_lab.on_each_tick(rel_lab);
90 auto& dow_btn = flex_actions_column.make_widget<
UI::Button>(0, 0, 128, 24);
93 if(relation.has_war) {
104 w.
set_tooltip(
translate(
"Declaring war on this nation will bring all their allies to their side"));
107 dow_btn.on_each_tick(dow_btn);
109 auto& allow_market_access_btn = flex_actions_column.make_widget<
UI::Button>(0, 0, 128, 24);
112 auto& allow_military_access_btn = flex_actions_column.make_widget<
UI::Button>(0, 0, 128, 24);
114 allow_military_access_btn.set_tooltip(
translate(
"Allow this nation to cross our land with their units"));
118 auto& switch_btn = flex_actions_column.make_widget<
UI::Button>(0, 0, 128, 24);
120 switch_btn.set_tooltip(
translate(
"Switches to this nation (multiplayer disallow rule)"));
123 this->gs.
map->map_render->request_update_visibility();
124 this->gs.
map->map_render->update();
std::shared_ptr< Eng3D::IO::Asset::Base > get_unique(const Eng3D::IO::Path &path)
Obtaining an unique asset means the "first-found" policy applies.
Eng3D::TextureManager tex_man
Eng3D::IO::PackageManager package_man
std::shared_ptr< Eng3D::Texture > load(const std::string &path, TextureOptions options=default_options)
Finds a texture in the list of a texture manager if the texture is already in the list we load the sa...
std::unique_ptr< Map > map
std::shared_ptr< Eng3D::Texture > get_nation_flag(const Nation &nation)
NationView(GameState &gs, Nation &nation)
const Nation::ClientHint & get_client_hint() const
Image widget, can display pictures or effects on the screen.
Simple widget for drawing text on the screen, no multiline support.
void set_close_btn_function(std::function< void(Widget &)> on_click)
Nation::Relation & get_relation(NationId a, NationId b)
T::Id get_id(const T &obj) const
Get the id of an object, this is a template for all types except for tiles and locally-stored types (...
std::string translate(const std::string_view str)
std::string string_format(const std::string_view format, Args &&... args)
String formatter.
std::string translate_format(const std::string_view format, Args &&... args)
String formatter, with translation.
const char * c_str() const