Display and control characteristics

This commit is contained in:
Pcornat 2022-01-31 20:37:35 +01:00
parent acc2f0ca9d
commit 367d030ff1
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0
3 changed files with 114 additions and 12 deletions

View File

@ -34,6 +34,12 @@ namespace gui {
void stat_second_menu() noexcept; void stat_second_menu() noexcept;
void materiel_menu() noexcept;
void gloire_menu() noexcept;
void richesse_menu() noexcept;
public: public:
Gui() = delete; Gui() = delete;

View File

@ -13,6 +13,14 @@ using namespace std::string_view_literals;
namespace gui { namespace gui {
class Window; class Window;
enum class characChanged {
None,
Adresse,
Endurance,
Chance,
Habilete
};
class GuiData final { class GuiData final {
private: private:
friend class Gui; friend class Gui;
@ -21,6 +29,14 @@ namespace gui {
character::CharacterSheet &billy; character::CharacterSheet &billy;
std::pair<characChanged, std::uint32_t> base{ characChanged::None, 0 };
std::pair<characChanged, std::uint32_t> carac{ characChanged::None, 0 };
std::pair<characChanged, std::uint32_t> materiel{ characChanged::None, 0 };
std::pair<characChanged, std::uint32_t> additional{ characChanged::None, 0 };
public: public:
static constexpr std::array classes{ static constexpr std::array classes{
"Guerrier"sv, "Guerrier"sv,
@ -36,6 +52,14 @@ namespace gui {
~GuiData() noexcept = default; ~GuiData() noexcept = default;
[[nodiscard]] Window &get_window() const; [[nodiscard]] Window &get_window() const;
[[nodiscard]] const std::pair<characChanged, std::uint32_t> &get_base() const { return base; }
[[nodiscard]] const std::pair<characChanged, std::uint32_t> &get_carac() const { return carac; }
[[nodiscard]] const std::pair<characChanged, std::uint32_t> &get_materiel() const { return materiel; }
[[nodiscard]] const std::pair<characChanged, std::uint32_t> &get_additional() const { return additional; }
}; };
} }

View File

@ -87,6 +87,17 @@ void gui::Gui::render_gui(const Controller &controller) {
stat_second_menu(); stat_second_menu();
materiel_menu();
ImGui::SameLine();
ImGui::BeginGroup();
gloire_menu();
richesse_menu();
ImGui::EndGroup();
ImGui::End(); ImGui::End();
controller.control_menu(); controller.control_menu();
@ -105,36 +116,79 @@ void gui::Gui::render_gpu() const {
void gui::Gui::habilete_menu() noexcept { void gui::Gui::habilete_menu() noexcept {
ImGui::BeginChild("habilete", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true); ImGui::BeginChild("habilete", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true);
ImGui::Text("Habileté"); 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;
ImGui::EndChild(); ImGui::EndChild();
} }
void gui::Gui::adresse_menu() noexcept { void gui::Gui::adresse_menu() noexcept {
ImGui::BeginChild("adresse", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true); ImGui::BeginChild("adresse", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true);
ImGui::Text("Adresse"); ImGui::Text("Adresse");
ImGui::Text("Bottom pane1"); data.base.second = data.billy.get_adresse().get_base();
ImGui::Text("Bottom pane2"); data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Adresse : characChanged::None;
ImGui::Text("Bottom pane3");
ImGui::Text("Bottom pane4"); 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;
ImGui::EndChild(); ImGui::EndChild();
} }
void gui::Gui::endurance_menu() noexcept { void gui::Gui::endurance_menu() noexcept {
ImGui::BeginChild("endurance", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true); ImGui::BeginChild("endurance", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true);
ImGui::Text("Endurance"); ImGui::Text("Endurance");
ImGui::Text("Bottom pane1");
ImGui::Text("Bottom pane2"); data.base.second = data.billy.get_endurance().get_base();
ImGui::Text("Bottom pane3"); data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Endurance : characChanged::None;
ImGui::Text("Bottom pane4");
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;
ImGui::EndChild(); ImGui::EndChild();
} }
void gui::Gui::chance_menu() noexcept { void gui::Gui::chance_menu() noexcept {
ImGui::BeginChild("chance", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true); ImGui::BeginChild("chance", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true);
ImGui::Text("Chance"); ImGui::Text("Chance");
ImGui::Text("Bottom pane1"); data.base.second = data.billy.get_chance().get_base();
ImGui::Text("Bottom pane2"); data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Chance : characChanged::None;
ImGui::Text("Bottom pane3");
ImGui::Text("Bottom pane4"); 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;
ImGui::EndChild(); ImGui::EndChild();
} }
@ -143,3 +197,21 @@ void gui::Gui::stat_second_menu() noexcept {
ImGui::Text("STAT. SECONDAIRES"); ImGui::Text("STAT. SECONDAIRES");
ImGui::EndChild(); ImGui::EndChild();
} }
void gui::Gui::materiel_menu() noexcept {
ImGui::BeginChild("materiel", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true);
ImGui::Text("Matériel");
ImGui::EndChild();
}
void gui::Gui::gloire_menu() noexcept {
ImGui::BeginChild("gloire", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f), true);
ImGui::Text("Gloire");
ImGui::EndChild();
}
void gui::Gui::richesse_menu() noexcept {
ImGui::BeginChild("richesse", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f), true);
ImGui::Text("Richesse");
ImGui::EndChild();
}