Compare commits

..

3 commits

Author SHA1 Message Date
8a91b47152
Better looking 2026-03-18 14:47:08 +01:00
5cadda6b97
Adding damage, armor and critic labels. 2026-03-18 14:47:02 +01:00
97d57bae7a
Adapting to the new library version 2026-03-18 14:32:55 +01:00
3 changed files with 32 additions and 9 deletions

View file

@ -206,6 +206,10 @@ namespace gui_to_app {
app_builder
};
damage_label = app_builder->get_widget<Gtk::Label>("label_degat");
armor_label = app_builder->get_widget<Gtk::Label>("label_armure");
critic_label = app_builder->get_widget<Gtk::Label>("label_critique");
debug_button->signal_clicked().connect(sigc::mem_fun(*this, &AppWin2Back::debug_button_clicked), false);
}
@ -225,7 +229,7 @@ namespace gui_to_app {
static void convert_to_label(std::array<char, 10> &convert,
const std::string_view &err_msg,
const uint32_t data,
const std::int32_t data,
Gtk::Label *const __restrict label) noexcept {
if (const auto [ptr, ec] = std::to_chars(convert.data(), convert.data() + convert.size(), data);
ec != std::errc()) {
@ -244,10 +248,13 @@ namespace gui_to_app {
const std::string_view short_name,
const CaracInterface<Gtk::Label> &labels) noexcept {
std::array<char, 10> convert{};
convert_to_label(convert, std::format("base {}", short_name), charac.get_base(), labels.base);
convert_to_label(convert,
std::format("base {}", short_name),
static_cast<std::int32_t>(charac.get_base()),
labels.base);
convert_to_label(convert,
std::format("carac {}", short_name),
charac.get_carac(),
static_cast<std::int32_t>(charac.get_carac()),
labels.carac);
convert_to_label(convert,
std::format("materiel {}", short_name),
@ -264,6 +271,11 @@ namespace gui_to_app {
update_in_labels(sheet.get_endurance(), "endu", endu_labels);
update_in_labels(sheet.get_adresse(), "adresse", addr_labels);
update_in_labels(sheet.get_chance(), "chance", luck_labels);
std::array<char, 10> convert{ '\0' };
convert_to_label(convert, "damage", static_cast<std::int32_t>(sheet.get_damage()), damage_label);
convert_to_label(convert, "armor", static_cast<std::int32_t>(sheet.get_armor()), armor_label);
convert_to_label(convert, "critic", static_cast<std::int32_t>(sheet.get_critique()), critic_label);
}
bool AppWin2Back::insert_obj(const character::billyEnums &obj) noexcept {

View file

@ -108,6 +108,10 @@ namespace gui_to_app {
CaracInterface<Gtk::Label> luck_labels;
Gtk::Label *damage_label{ nullptr };
Gtk::Label *armor_label{ nullptr };
Gtk::Label *critic_label{ nullptr };
Gtk::Button *debug_button{ nullptr };
std::array<SwitchSignalHelper, 12> signal_handlers{

View file

@ -536,6 +536,7 @@
<object class="GtkGrid">
<child>
<object class="GtkGrid">
<property name="hexpand">True</property>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
@ -549,7 +550,8 @@
</child>
<child>
<object class="GtkLabel" id="adresse_label_base">
<property name="halign">end</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<layout>
<property name="column">1</property>
<property name="row">0</property>
@ -568,7 +570,7 @@
</child>
<child>
<object class="GtkLabel" id="adresse_label_carac">
<property name="halign">end</property>
<property name="halign">center</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
@ -587,7 +589,7 @@
</child>
<child>
<object class="GtkLabel" id="adresse_label_materiel">
<property name="halign">end</property>
<property name="halign">center</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
@ -611,6 +613,8 @@
</child>
<child>
<object class="GtkLabel" id="adresse_label_total">
<property name="halign">center</property>
<property name="hexpand">True</property>
<layout>
<property name="column">2</property>
<property name="row">0</property>
@ -654,7 +658,8 @@
</child>
<child>
<object class="GtkLabel" id="chance_label_base">
<property name="halign">end</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<layout>
<property name="column">1</property>
<property name="row">0</property>
@ -673,7 +678,7 @@
</child>
<child>
<object class="GtkLabel" id="chance_label_carac">
<property name="halign">end</property>
<property name="halign">center</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
@ -692,7 +697,7 @@
</child>
<child>
<object class="GtkLabel" id="chance_label_materiel">
<property name="halign">end</property>
<property name="halign">center</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
@ -716,6 +721,8 @@
</child>
<child>
<object class="GtkLabel" id="chance_label_total">
<property name="halign">center</property>
<property name="hexpand">True</property>
<layout>
<property name="column">2</property>
<property name="row">0</property>