25 #include "eng3d/serializer.hpp"
26 #include "eng3d/ui/text.hpp"
27 #include "eng3d/ui/tooltip.hpp"
28 #include "eng3d/ui/close_button.hpp"
29 #include "eng3d/ui/div.hpp"
30 #include "eng3d/ui/image.hpp"
31 #include "eng3d/network.hpp"
40 :
UI::Window(-(600 / 2), 0, 600, 0),
52 this->make_widget<UI::Image>(0, 24, this->
width, 200, path);
57 auto& txt = this->make_widget<UI::Text>(0, 0, this->
width, 24);
59 txt.set_text(this->event.
text);
66 glm::ivec2 size(3, 3);
67 glm::ivec2 texture_size(3, 3);
68 auto button_border =
UI::Border(button_border_image, size, texture_size);
71 for(
const auto& decision : this->event.
decisions) {
72 auto& flex_column = this->make_widget<UI::Div>(0, 0, this->
width - 24, 24);
75 if(decision.ref_name.get_string().empty())
78 auto& decide_btn = flex_column.make_widget<
UI::Button>(0, 0, flex_column.width - 24, 24);
79 decide_btn.
border = button_border;
80 decide_btn.current_texture = button_image;
81 decide_btn.font = button_font;
82 decide_btn.text_color = button_text_color;
83 decide_btn.set_text(decision.name);
84 decide_btn.set_tooltip(decision.effects);
85 decide_btn.set_on_click([
this, &decision](
UI::Widget&) {
91 auto& remind_ibtn = flex_column.make_widget<
UI::Image>(0, 0, 24, 24,
"gfx/noicon.png");
93 remind_ibtn.set_on_click([
this, &decision](
UI::Widget&) {
101 auto it = std::find(this->gs.
decision_autodo.begin(), this->gs.decision_autodo.end(), decision.ref_name);
103 decide_btn.on_click(decide_btn);
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::TrueType::Manager ttf_man
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::shared_ptr< Eng3D::TrueType::Font > load(std::shared_ptr< Eng3D::IO::Asset::Base > asset)
std::unique_ptr< Client > client
std::vector< Eng3D::StringRef > decision_autodo
DecisionWindow(GameState &gs, Event event)
Border class that defines the texture and size of borders of the widgets.
Image widget, can display pictures or effects on the screen.
std::string translate(const std::string_view str)
void warning(const std::string_view category, const std::string_view msg)
std::string string_format(const std::string_view format, Args &&... args)
String formatter.
static Eng3D::Networking::Packet form_packet(const Event &event, const Decision &decision)
Primitive color type used through the engine.
constexpr static Color rgb8(uint8_t red, uint8_t green, uint8_t blue)
Create a color from RGB components.
const char * c_str() const
std::vector< Decision > decisions
Eng3D::StringRef ref_name
#define CXX_THROW(class,...)