Better displaying characteristics
This commit is contained in:
parent
7d4981e02c
commit
1d609f12d5
@ -8,6 +8,10 @@ namespace fs = std::filesystem;
|
||||
|
||||
class Controller;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Characteristic;
|
||||
}
|
||||
|
||||
namespace gui {
|
||||
|
||||
class GuiData;
|
||||
@ -52,6 +56,8 @@ namespace gui {
|
||||
void render_gui(const Controller &controller);
|
||||
|
||||
void render_gpu() const;
|
||||
|
||||
static void characteristic_gui(const character::characteristic::Characteristic &characteristic) noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include "character_sheet.hpp"
|
||||
#include "controller.hpp"
|
||||
#include "billy_objects.hpp"
|
||||
#include "characteristic/characteristic.hpp"
|
||||
|
||||
using character::characteristic::Characteristic;
|
||||
|
||||
gui::Gui::Gui(Window &window, GuiData &data, menu::MenuData &menuData) :
|
||||
data(data), menu(menuData), font("font/DejaVuSans.ttf") {
|
||||
@ -112,27 +115,26 @@ void gui::Gui::render_gpu() const {
|
||||
}
|
||||
}
|
||||
|
||||
void gui::Gui::characteristic_gui(const Characteristic &characteristic) noexcept {
|
||||
int base = static_cast<int>(characteristic.get_base());
|
||||
(void) ImGui::InputInt("Base", &base, 1, 100, ImGuiInputTextFlags_ReadOnly);
|
||||
|
||||
int carac = static_cast<int>(characteristic.get_carac());
|
||||
(void) ImGui::InputInt("Carac", &carac, 1, 100, ImGuiInputTextFlags_ReadOnly);
|
||||
|
||||
int materiel = static_cast<int>(characteristic.get_materiel());
|
||||
(void) ImGui::InputInt("Matériel", &materiel, 1, 100, ImGuiInputTextFlags_ReadOnly);
|
||||
|
||||
int additional = static_cast<int>(characteristic.get_additional());
|
||||
(void) ImGui::InputInt("Additionnel", &additional, 1, 100, ImGuiInputTextFlags_ReadOnly);
|
||||
}
|
||||
|
||||
void gui::Gui::habilete_menu() noexcept {
|
||||
ImGui::BeginChild("habilete",
|
||||
ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
|
||||
ImGuiChildFlags_Border);
|
||||
ImGui::Text("Habileté");
|
||||
data.base.second = data.billy.get_habilete().get_base();
|
||||
data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Habilete
|
||||
: characChanged::None;
|
||||
|
||||
data.carac.second = data.billy.get_habilete().get_carac();
|
||||
data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Habilete
|
||||
: characChanged::None;
|
||||
|
||||
data.materiel.second = data.billy.get_habilete().get_materiel();
|
||||
data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second))
|
||||
? characChanged::Habilete : characChanged::None;
|
||||
|
||||
data.additional.second = data.billy.get_habilete().get_additional();
|
||||
data.additional.first = ImGui::InputInt("Additionnel", reinterpret_cast<int *>(&data.additional.second)) ?
|
||||
characChanged::Habilete :
|
||||
characChanged::None;
|
||||
characteristic_gui(static_cast<const Characteristic &>(data.billy.get_habilete()));
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
@ -141,22 +143,7 @@ void gui::Gui::adresse_menu() noexcept {
|
||||
ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
|
||||
ImGuiChildFlags_Border);
|
||||
ImGui::Text("Adresse");
|
||||
data.base.second = data.billy.get_adresse().get_base();
|
||||
data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Adresse
|
||||
: characChanged::None;
|
||||
|
||||
data.carac.second = data.billy.get_adresse().get_carac();
|
||||
data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Adresse
|
||||
: characChanged::None;
|
||||
|
||||
data.materiel.second = data.billy.get_adresse().get_materiel();
|
||||
data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second))
|
||||
? characChanged::Adresse : characChanged::None;
|
||||
|
||||
data.additional.second = data.billy.get_adresse().get_additional();
|
||||
data.additional.first = ImGui::InputInt("Additionnel", reinterpret_cast<int *>(&data.additional.second)) ?
|
||||
characChanged::Adresse :
|
||||
characChanged::None;
|
||||
characteristic_gui(static_cast<const Characteristic &>(data.billy.get_adresse()));
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
@ -165,24 +152,7 @@ void gui::Gui::endurance_menu() noexcept {
|
||||
ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
|
||||
ImGuiChildFlags_Border);
|
||||
ImGui::Text("Endurance");
|
||||
|
||||
data.base.second = data.billy.get_endurance().get_base();
|
||||
data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Endurance
|
||||
: characChanged::None;
|
||||
|
||||
data.carac.second = data.billy.get_endurance().get_carac();
|
||||
data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Endurance
|
||||
: characChanged::None;
|
||||
|
||||
data.materiel.second = data.billy.get_endurance().get_materiel();
|
||||
data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) ?
|
||||
characChanged::Endurance :
|
||||
characChanged::None;
|
||||
|
||||
data.additional.second = data.billy.get_endurance().get_additional();
|
||||
data.additional.first = ImGui::InputInt("Additionnel", reinterpret_cast<int *>(&data.additional.second)) ?
|
||||
characChanged::Endurance :
|
||||
characChanged::None;
|
||||
characteristic_gui(static_cast<const Characteristic &>(data.billy.get_endurance()));
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
@ -191,22 +161,7 @@ void gui::Gui::chance_menu() noexcept {
|
||||
ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
|
||||
ImGuiChildFlags_Border);
|
||||
ImGui::Text("Chance");
|
||||
data.base.second = data.billy.get_chance().get_base();
|
||||
data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Chance
|
||||
: characChanged::None;
|
||||
|
||||
data.carac.second = data.billy.get_chance().get_carac();
|
||||
data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Chance
|
||||
: characChanged::None;
|
||||
|
||||
data.materiel.second = data.billy.get_chance().get_materiel();
|
||||
data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second))
|
||||
? characChanged::Chance : characChanged::None;
|
||||
|
||||
data.additional.second = data.billy.get_chance().get_additional();
|
||||
data.additional.first = ImGui::InputInt("Additionnel", reinterpret_cast<int *>(&data.additional.second)) ?
|
||||
characChanged::Chance :
|
||||
characChanged::None;
|
||||
characteristic_gui(static_cast<const Characteristic&>(data.billy.get_chance()));
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user