Reformat.
This commit is contained in:
parent
7d1a0473ff
commit
2755f4827e
24 changed files with 6140 additions and 5829 deletions
|
@ -8,101 +8,109 @@
|
|||
#include <random>
|
||||
|
||||
namespace gui {
|
||||
class Gui;
|
||||
class Gui;
|
||||
}
|
||||
|
||||
namespace character {
|
||||
enum class classe : std::uint32_t {
|
||||
Guerrier = 0,
|
||||
Prudent = 1,
|
||||
Paysan = 2,
|
||||
Debrouillard = 3,
|
||||
};
|
||||
enum class classe : std::uint8_t {
|
||||
Guerrier = 0,
|
||||
Prudent = 1,
|
||||
Paysan = 2,
|
||||
Debrouillard = 3,
|
||||
};
|
||||
|
||||
class CharacterSheet final {
|
||||
private:
|
||||
friend gui::Gui;
|
||||
class CharacterSheet final {
|
||||
private:
|
||||
friend gui::Gui;
|
||||
|
||||
friend class Controller;
|
||||
friend class Controller;
|
||||
|
||||
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
|
||||
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
|
||||
|
||||
std::string caractere{};
|
||||
std::string caractere{};
|
||||
|
||||
characteristic::Adresse adresse;
|
||||
characteristic::Adresse adresse;
|
||||
|
||||
characteristic::Endurance endurance;
|
||||
characteristic::Endurance endurance;
|
||||
|
||||
characteristic::Chance chance;
|
||||
characteristic::Chance chance;
|
||||
|
||||
characteristic::Habilete habilete;
|
||||
characteristic::Habilete habilete;
|
||||
|
||||
classe current_class{ classe::Guerrier };
|
||||
classe current_class{ classe::Guerrier };
|
||||
|
||||
std::uint32_t health_point{ 0 };
|
||||
std::uint32_t health_point{ 0 };
|
||||
|
||||
std::uint32_t armor{ 0 };
|
||||
std::uint32_t armor{ 0 };
|
||||
|
||||
std::uint32_t damage{ 0 };
|
||||
std::uint32_t damage{ 0 };
|
||||
|
||||
std::uint32_t glory{ 0 };
|
||||
std::uint32_t glory{ 0 };
|
||||
|
||||
std::uint32_t money{ 0 };
|
||||
public:
|
||||
CharacterSheet() = default;
|
||||
std::uint32_t money{ 0 };
|
||||
public:
|
||||
CharacterSheet() = default;
|
||||
|
||||
~CharacterSheet() noexcept = default;
|
||||
CharacterSheet(const CharacterSheet &sheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const std::string &get_caractere() const { return caractere; }
|
||||
CharacterSheet(CharacterSheet &&sheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Adresse &get_adresse() const { return adresse; }
|
||||
CharacterSheet &operator=(const CharacterSheet &characterSheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Endurance &get_endurance() const { return endurance; }
|
||||
CharacterSheet &operator=(CharacterSheet &&characterSheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Chance &get_chance() const { return chance; }
|
||||
~CharacterSheet() noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Habilete &get_habilete() const { return habilete; }
|
||||
[[nodiscard]] const std::string &get_caractere() const { return caractere; }
|
||||
|
||||
[[nodiscard]] classe get_current_class() const { return current_class; }
|
||||
[[nodiscard]] const characteristic::Adresse &get_adresse() const { return adresse; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_health_point() const { return health_point; }
|
||||
[[nodiscard]] const characteristic::Endurance &get_endurance() const { return endurance; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_armor() const { return armor; }
|
||||
[[nodiscard]] const characteristic::Chance &get_chance() const { return chance; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_damage() const { return damage; }
|
||||
[[nodiscard]] const characteristic::Habilete &get_habilete() const { return habilete; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_glory() const { return glory; }
|
||||
[[nodiscard]] classe get_current_class() const { return current_class; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_money() const { return money; }
|
||||
[[nodiscard]] std::uint32_t get_health_point() const { return health_point; }
|
||||
|
||||
friend void from_json(const json &j, CharacterSheet &billy) {
|
||||
j.at("caractere").get_to(billy.caractere);
|
||||
j.at("adresse").get_to(billy.adresse);
|
||||
j.at("endurance").get_to(billy.endurance);
|
||||
j.at("chance").get_to(billy.chance);
|
||||
j.at("habilete").get_to(billy.habilete);
|
||||
j.at("classe").get_to(billy.current_class);
|
||||
j.at("health_point").get_to(billy.health_point);
|
||||
j.at("armor").get_to(billy.armor);
|
||||
j.at("damage").get_to(billy.damage);
|
||||
j.at("glory").get_to(billy.glory);
|
||||
j.at("money").get_to(billy.money);
|
||||
}
|
||||
};
|
||||
[[nodiscard]] std::uint32_t get_armor() const { return armor; }
|
||||
|
||||
static void to_json(json &j, const CharacterSheet &billy) {
|
||||
j["caractere"] = billy.get_caractere();
|
||||
j["adresse"] = billy.get_adresse();
|
||||
j["endurance"] = billy.get_endurance();
|
||||
j["chance"] = billy.get_chance();
|
||||
j["habilete"] = billy.get_habilete();
|
||||
j["classe"] = billy.get_current_class();
|
||||
j["health_point"] = billy.get_health_point();
|
||||
j["armor"] = billy.get_armor();
|
||||
j["damage"] = billy.get_damage();
|
||||
j["glory"] = billy.get_glory();
|
||||
j["money"] = billy.get_money();
|
||||
}
|
||||
[[nodiscard]] std::uint32_t get_damage() const { return damage; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_glory() const { return glory; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_money() const { return money; }
|
||||
|
||||
friend void from_json(const json &j, CharacterSheet &billy) {
|
||||
j.at("caractere").get_to(billy.caractere);
|
||||
j.at("adresse").get_to(billy.adresse);
|
||||
j.at("endurance").get_to(billy.endurance);
|
||||
j.at("chance").get_to(billy.chance);
|
||||
j.at("habilete").get_to(billy.habilete);
|
||||
j.at("classe").get_to(billy.current_class);
|
||||
j.at("health_point").get_to(billy.health_point);
|
||||
j.at("armor").get_to(billy.armor);
|
||||
j.at("damage").get_to(billy.damage);
|
||||
j.at("glory").get_to(billy.glory);
|
||||
j.at("money").get_to(billy.money);
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const CharacterSheet &billy) {
|
||||
j["caractere"] = billy.get_caractere();
|
||||
j["adresse"] = billy.get_adresse();
|
||||
j["endurance"] = billy.get_endurance();
|
||||
j["chance"] = billy.get_chance();
|
||||
j["habilete"] = billy.get_habilete();
|
||||
j["classe"] = billy.get_current_class();
|
||||
j["health_point"] = billy.get_health_point();
|
||||
j["armor"] = billy.get_armor();
|
||||
j["damage"] = billy.get_damage();
|
||||
j["glory"] = billy.get_glory();
|
||||
j["money"] = billy.get_money();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,20 +7,20 @@
|
|||
using json = nlohmann::json;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Adresse final : public Characteristic {
|
||||
public:
|
||||
Adresse() noexcept: Characteristic(1, 0, 0, 0) {}
|
||||
class Adresse final : public Characteristic {
|
||||
public:
|
||||
Adresse() noexcept: Characteristic(1, 0, 0, 0) {}
|
||||
|
||||
~Adresse() noexcept final = default;
|
||||
~Adresse() noexcept final = default;
|
||||
|
||||
friend void from_json(const json &j, Adresse &adresse) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(adresse));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Adresse &adresse) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(adresse));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Adresse &adresse) {
|
||||
to_json(j, static_cast<Characteristic>(adresse));
|
||||
}
|
||||
static void to_json(json &j, const Adresse &adresse) {
|
||||
to_json(j, static_cast<Characteristic>(adresse));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
#include "characteristic.hpp"
|
||||
|
||||
namespace character::characteristic {
|
||||
class Chance final : public Characteristic {
|
||||
public:
|
||||
Chance() noexcept: Characteristic(3, 0, 0, 0) {}
|
||||
class Chance final : public Characteristic {
|
||||
public:
|
||||
Chance() noexcept: Characteristic(3, 0, 0, 0) {}
|
||||
|
||||
~Chance() noexcept final = default;
|
||||
~Chance() noexcept final = default;
|
||||
|
||||
friend void from_json(const json &j, Chance &chance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(chance));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Chance &chance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(chance));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Chance &chance) {
|
||||
to_json(j, static_cast<Characteristic>(chance));
|
||||
}
|
||||
static void to_json(json &j, const Chance &chance) {
|
||||
to_json(j, static_cast<Characteristic>(chance));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,53 +7,56 @@
|
|||
using json = nlohmann::json;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Characteristic {
|
||||
protected:
|
||||
const std::uint32_t base{ 0 };
|
||||
std::uint32_t carac{ 0 };
|
||||
std::uint32_t materiel{ 0 };
|
||||
std::uint32_t additional{ 0 };
|
||||
class Characteristic {
|
||||
protected:
|
||||
const std::uint32_t base{ 0 };
|
||||
std::uint32_t carac{ 0 };
|
||||
std::uint32_t materiel{ 0 };
|
||||
std::uint32_t additional{ 0 };
|
||||
|
||||
public:
|
||||
Characteristic() noexcept = default;
|
||||
public:
|
||||
Characteristic() noexcept = default;
|
||||
|
||||
Characteristic(const std::uint32_t base, const std::uint32_t carac, const std::uint32_t materiel, const std::uint32_t additional) noexcept:
|
||||
base(base), carac(carac), materiel(materiel), additional(additional) {}
|
||||
Characteristic(const std::uint32_t base,
|
||||
const std::uint32_t carac,
|
||||
const std::uint32_t materiel,
|
||||
const std::uint32_t additional) noexcept:
|
||||
base(base), carac(carac), materiel(materiel), additional(additional) {}
|
||||
|
||||
Characteristic(const Characteristic &charac) noexcept = default;
|
||||
Characteristic(const Characteristic &charac) noexcept = default;
|
||||
|
||||
Characteristic &operator=(const Characteristic &charac) noexcept {
|
||||
const_cast<std::uint32_t &>(base) = charac.base;
|
||||
carac = charac.carac;
|
||||
materiel = charac.materiel;
|
||||
additional = charac.additional;
|
||||
return *this;
|
||||
}
|
||||
Characteristic &operator=(const Characteristic &charac) noexcept {
|
||||
const_cast<std::uint32_t &>(base) = charac.base;
|
||||
carac = charac.carac;
|
||||
materiel = charac.materiel;
|
||||
additional = charac.additional;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~Characteristic() noexcept = default;
|
||||
virtual ~Characteristic() noexcept = default;
|
||||
|
||||
[[nodiscard]] std::uint32_t get_base() const { return base; }
|
||||
[[nodiscard]] std::uint32_t get_base() const { return base; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
||||
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_materiel() const { return materiel; }
|
||||
[[nodiscard]] std::uint32_t get_materiel() const { return materiel; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_additional() const { return additional; }
|
||||
[[nodiscard]] std::uint32_t get_additional() const { return additional; }
|
||||
|
||||
friend void from_json(const json &j, Characteristic &charac) {
|
||||
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
||||
charac.carac = j.at("carac").get<std::uint32_t>();
|
||||
charac.materiel = j.at("materiel").get<std::uint32_t>();
|
||||
charac.additional = j.at("additional").get<std::uint32_t>();
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Characteristic &charac) {
|
||||
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
||||
charac.carac = j.at("carac").get<std::uint32_t>();
|
||||
charac.materiel = j.at("materiel").get<std::uint32_t>();
|
||||
charac.additional = j.at("additional").get<std::uint32_t>();
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Characteristic &charac) {
|
||||
j["base"] = charac.get_base();
|
||||
j["carac"] = charac.get_carac();
|
||||
j["materiel"] = charac.get_materiel();
|
||||
j["additional"] = charac.get_additional();
|
||||
}
|
||||
static void to_json(json &j, const Characteristic &charac) {
|
||||
j["base"] = charac.get_base();
|
||||
j["carac"] = charac.get_carac();
|
||||
j["materiel"] = charac.get_materiel();
|
||||
j["additional"] = charac.get_additional();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,22 +7,22 @@
|
|||
using json = nlohmann::json;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Endurance final : public Characteristic {
|
||||
public:
|
||||
Endurance() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
class Endurance final : public Characteristic {
|
||||
public:
|
||||
Endurance() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
|
||||
~Endurance() noexcept final = default;
|
||||
~Endurance() noexcept final = default;
|
||||
|
||||
[[nodiscard]] std::uint32_t get_max_lp() const noexcept;
|
||||
[[nodiscard]] std::uint32_t get_max_lp() const noexcept;
|
||||
|
||||
friend void from_json(const json &j, Endurance &endurance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(endurance));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Endurance &endurance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(endurance));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Endurance &endurance) {
|
||||
to_json(j, static_cast<Characteristic>(endurance));
|
||||
}
|
||||
static void to_json(json &j, const Endurance &endurance) {
|
||||
to_json(j, static_cast<Characteristic>(endurance));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
#include "characteristic.hpp"
|
||||
|
||||
namespace character::characteristic {
|
||||
class Habilete final : public Characteristic {
|
||||
public:
|
||||
Habilete() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
class Habilete final : public Characteristic {
|
||||
public:
|
||||
Habilete() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
|
||||
~Habilete() noexcept final = default;
|
||||
~Habilete() noexcept final = default;
|
||||
|
||||
friend void from_json(const json &j, Habilete &habilete) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(habilete));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Habilete &habilete) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(habilete));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Habilete &habilete) {
|
||||
to_json(j, static_cast<Characteristic>(habilete));
|
||||
}
|
||||
static void to_json(json &j, const Habilete &habilete) {
|
||||
to_json(j, static_cast<Characteristic>(habilete));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,28 +2,29 @@
|
|||
#define BILLYSHEET_CONTROLLER_HPP
|
||||
|
||||
namespace character {
|
||||
class CharacterSheet;
|
||||
class CharacterSheet;
|
||||
}
|
||||
|
||||
namespace gui::menu {
|
||||
class MenuData;
|
||||
class MenuData;
|
||||
}
|
||||
|
||||
class Controller final {
|
||||
private:
|
||||
character::CharacterSheet &sheet;
|
||||
gui::menu::MenuData &menu_data;
|
||||
character::CharacterSheet &sheet;
|
||||
gui::menu::MenuData &menu_data;
|
||||
|
||||
public:
|
||||
Controller() = delete;
|
||||
Controller() = delete;
|
||||
|
||||
explicit Controller(character::CharacterSheet &sheet, gui::menu::MenuData &menuData) : sheet(sheet), menu_data(menuData) {}
|
||||
explicit Controller(character::CharacterSheet &sheet, gui::menu::MenuData &menuData) :
|
||||
sheet(sheet), menu_data(menuData) {}
|
||||
|
||||
~Controller() noexcept = default;
|
||||
~Controller() noexcept = default;
|
||||
|
||||
void control_menu() const noexcept;
|
||||
void control_menu() const noexcept;
|
||||
|
||||
void control_sheet()const noexcept;
|
||||
void control_sheet() const noexcept;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -10,49 +10,49 @@ class Controller;
|
|||
|
||||
namespace gui {
|
||||
|
||||
class GuiData;
|
||||
class GuiData;
|
||||
|
||||
class Window;
|
||||
class Window;
|
||||
|
||||
namespace menu { class MenuData; }
|
||||
namespace menu { class MenuData; }
|
||||
|
||||
class Gui final {
|
||||
private:
|
||||
GuiData &data;
|
||||
class Gui final {
|
||||
private:
|
||||
GuiData &data;
|
||||
|
||||
menu::Menu menu;
|
||||
menu::Menu menu;
|
||||
|
||||
const fs::path font;
|
||||
const fs::path font;
|
||||
|
||||
bool initialized{ false };
|
||||
bool initialized{ false };
|
||||
|
||||
void habilete_menu() noexcept;
|
||||
void habilete_menu() noexcept;
|
||||
|
||||
void adresse_menu() noexcept;
|
||||
void adresse_menu() noexcept;
|
||||
|
||||
void endurance_menu() noexcept;
|
||||
void endurance_menu() noexcept;
|
||||
|
||||
void chance_menu() noexcept;
|
||||
void chance_menu() noexcept;
|
||||
|
||||
void stat_second_menu() noexcept;
|
||||
void stat_second_menu() noexcept;
|
||||
|
||||
void materiel_menu() noexcept;
|
||||
void materiel_menu() noexcept;
|
||||
|
||||
void gloire_menu() noexcept;
|
||||
void gloire_menu() noexcept;
|
||||
|
||||
void richesse_menu() noexcept;
|
||||
void richesse_menu() noexcept;
|
||||
|
||||
public:
|
||||
Gui() = delete;
|
||||
public:
|
||||
Gui() = delete;
|
||||
|
||||
explicit Gui(Window &window, GuiData &data, menu::MenuData &menuData);
|
||||
explicit Gui(Window &window, GuiData &data, menu::MenuData &menuData);
|
||||
|
||||
~Gui() noexcept;
|
||||
~Gui() noexcept;
|
||||
|
||||
void render_gui(const Controller &controller);
|
||||
void render_gui(const Controller &controller);
|
||||
|
||||
void render_gpu() const;
|
||||
};
|
||||
void render_gpu() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //BILLYSHEET_GUI_HPP
|
||||
|
|
|
@ -5,57 +5,57 @@
|
|||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace character {
|
||||
class CharacterSheet;
|
||||
class CharacterSheet;
|
||||
}
|
||||
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
namespace gui {
|
||||
|
||||
enum class characChanged {
|
||||
None,
|
||||
Adresse,
|
||||
Endurance,
|
||||
Chance,
|
||||
Habilete
|
||||
};
|
||||
enum class characChanged {
|
||||
None,
|
||||
Adresse,
|
||||
Endurance,
|
||||
Chance,
|
||||
Habilete
|
||||
};
|
||||
|
||||
class GuiData final {
|
||||
private:
|
||||
friend class Gui;
|
||||
class GuiData final {
|
||||
private:
|
||||
friend class Gui;
|
||||
|
||||
character::CharacterSheet &billy;
|
||||
character::CharacterSheet &billy;
|
||||
|
||||
std::pair<characChanged, std::uint32_t> base{ characChanged::None, 0 };
|
||||
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> carac{ characChanged::None, 0 };
|
||||
|
||||
std::pair<characChanged, std::uint32_t> materiel{ characChanged::None, 0 };
|
||||
std::pair<characChanged, std::uint32_t> materiel{ characChanged::None, 0 };
|
||||
|
||||
std::pair<characChanged, std::uint32_t> additional{ characChanged::None, 0 };
|
||||
std::pair<characChanged, std::uint32_t> additional{ characChanged::None, 0 };
|
||||
|
||||
public:
|
||||
static constexpr std::array classes{
|
||||
"Guerrier"sv,
|
||||
"Prudent"sv,
|
||||
"Paysan"sv,
|
||||
"Débrouillard"sv
|
||||
};
|
||||
public:
|
||||
static constexpr std::array classes{
|
||||
"Guerrier"sv,
|
||||
"Prudent"sv,
|
||||
"Paysan"sv,
|
||||
"Débrouillard"sv
|
||||
};
|
||||
|
||||
GuiData() = delete;
|
||||
GuiData() = delete;
|
||||
|
||||
explicit GuiData(character::CharacterSheet &billy) noexcept: billy(billy) { SPDLOG_DEBUG("Creating GUI Data"); }
|
||||
explicit GuiData(character::CharacterSheet &billy) noexcept: billy(billy) { SPDLOG_DEBUG("Creating GUI Data"); }
|
||||
|
||||
~GuiData() noexcept = default;
|
||||
~GuiData() noexcept = default;
|
||||
|
||||
[[nodiscard]] const std::pair<characChanged, std::uint32_t> &get_base() const { return base; }
|
||||
[[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_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_materiel() const { return materiel; }
|
||||
|
||||
[[nodiscard]] const std::pair<characChanged, std::uint32_t> &get_additional() const { return additional; }
|
||||
};
|
||||
[[nodiscard]] const std::pair<characChanged, std::uint32_t> &get_additional() const { return additional; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,26 +4,26 @@
|
|||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace gui {
|
||||
class GuiData;
|
||||
class GuiData;
|
||||
|
||||
namespace menu {
|
||||
class MenuData;
|
||||
namespace menu {
|
||||
class MenuData;
|
||||
|
||||
class Menu final {
|
||||
private:
|
||||
MenuData &data;
|
||||
public:
|
||||
Menu() noexcept = delete;
|
||||
class Menu final {
|
||||
private:
|
||||
MenuData &data;
|
||||
public:
|
||||
Menu() noexcept = delete;
|
||||
|
||||
explicit Menu(MenuData &data) noexcept;
|
||||
explicit Menu(MenuData &data) noexcept;
|
||||
|
||||
~Menu() noexcept = default;
|
||||
~Menu() noexcept = default;
|
||||
|
||||
void gui() const noexcept;
|
||||
void gui() const noexcept;
|
||||
|
||||
[[nodiscard]] const MenuData &get_data() const { return data; }
|
||||
};
|
||||
}
|
||||
[[nodiscard]] const MenuData &get_data() const { return data; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,38 +8,40 @@ namespace fs = std::filesystem;
|
|||
class Controller;
|
||||
|
||||
namespace character {
|
||||
class CharacterSheet;
|
||||
class CharacterSheet;
|
||||
}
|
||||
|
||||
namespace gui::menu {
|
||||
class MenuData final {
|
||||
public:
|
||||
const std::string open_character_key{ "CharacterSheetOpen" };
|
||||
class MenuData final {
|
||||
public:
|
||||
const std::string open_character_key{ "CharacterSheetOpen" };
|
||||
|
||||
const std::string save_character_key{ "CharacterSheetSaveAs" };
|
||||
private:
|
||||
friend class Menu;
|
||||
const std::string save_character_key{ "CharacterSheetSaveAs" };
|
||||
private:
|
||||
friend class Menu;
|
||||
|
||||
const character::CharacterSheet &character_sheet;
|
||||
const character::CharacterSheet &character_sheet;
|
||||
|
||||
mutable fs::path save_path{ "./" };
|
||||
mutable fs::path save_path{ "./" };
|
||||
|
||||
mutable std::string filename{ "character_sheet.json" };
|
||||
mutable std::string filename{ "character_sheet.json" };
|
||||
|
||||
bool edit_mode{ true };
|
||||
public:
|
||||
MenuData() noexcept = delete;
|
||||
bool edit_mode{ true };
|
||||
public:
|
||||
MenuData() noexcept = delete;
|
||||
|
||||
explicit MenuData(const character::CharacterSheet &characterSheet) noexcept: character_sheet(characterSheet) {}
|
||||
explicit MenuData(const character::CharacterSheet &characterSheet) noexcept: character_sheet(characterSheet) {}
|
||||
|
||||
~MenuData() noexcept = default;
|
||||
~MenuData() noexcept = default;
|
||||
|
||||
[[nodiscard]] bool is_edit_mode() const { return edit_mode; }
|
||||
[[nodiscard]] bool is_edit_mode() const { return edit_mode; }
|
||||
|
||||
void set_save_path([[maybe_unused]] const Controller &controller, const fs::path &savePath) const { save_path = savePath; }
|
||||
void set_save_path([[maybe_unused]] const Controller &controller,
|
||||
const fs::path &savePath) const { save_path = savePath; }
|
||||
|
||||
void set_filename([[maybe_unused]] const Controller &controller, const std::string &fileName) const { filename = fileName; }
|
||||
};
|
||||
void set_filename([[maybe_unused]] const Controller &controller,
|
||||
const std::string &fileName) const { filename = fileName; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,28 +7,29 @@
|
|||
#include <memory>
|
||||
|
||||
namespace gui {
|
||||
class Window final {
|
||||
private:
|
||||
static void delete_glfw_window(GLFWwindow *glfWwindow) {
|
||||
glfwDestroyWindow(glfWwindow);
|
||||
glfwTerminate();
|
||||
}
|
||||
class Window final {
|
||||
private:
|
||||
static void delete_glfw_window(GLFWwindow *glfWwindow) {
|
||||
glfwDestroyWindow(glfWwindow);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> wwindow{ nullptr, delete_glfw_window };
|
||||
std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> wwindow{ nullptr, delete_glfw_window };
|
||||
|
||||
public:
|
||||
Window();
|
||||
public:
|
||||
Window();
|
||||
|
||||
Window(Window &&window) noexcept: wwindow(std::move(window.wwindow)) {}
|
||||
Window(Window &&window) noexcept: wwindow(std::move(window.wwindow)) {}
|
||||
|
||||
~Window() noexcept = default;
|
||||
~Window() noexcept = default;
|
||||
|
||||
[[nodiscard]] const std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> &get_window() const { return wwindow; }
|
||||
[[nodiscard]] const std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> &
|
||||
get_window() const { return wwindow; }
|
||||
|
||||
[[nodiscard]] bool should_close() const noexcept;
|
||||
[[nodiscard]] bool should_close() const noexcept;
|
||||
|
||||
void swap_buffers() const noexcept;
|
||||
};
|
||||
void swap_buffers() const noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,48 +4,48 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace gui {
|
||||
class GuiDataInterface {
|
||||
public:
|
||||
GuiDataInterface() noexcept = default;
|
||||
class GuiDataInterface {
|
||||
public:
|
||||
GuiDataInterface() noexcept = default;
|
||||
|
||||
virtual ~GuiDataInterface() noexcept = default;
|
||||
virtual ~GuiDataInterface() noexcept = default;
|
||||
|
||||
virtual void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods) = 0;
|
||||
virtual void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods) = 0;
|
||||
|
||||
virtual void character_callback(GLFWwindow *window, unsigned int codepoint) = 0;
|
||||
virtual void character_callback(GLFWwindow *window, unsigned int codepoint) = 0;
|
||||
|
||||
virtual void cursor_position_callback(GLFWwindow *window, double xpos, double ypos) = 0;
|
||||
virtual void cursor_position_callback(GLFWwindow *window, double xpos, double ypos) = 0;
|
||||
|
||||
virtual void cursor_enter_callback(GLFWwindow *window, int entered) = 0;
|
||||
virtual void cursor_enter_callback(GLFWwindow *window, int entered) = 0;
|
||||
|
||||
virtual void mouse_button_callback(GLFWwindow *window, int button, int action, int mods) = 0;
|
||||
virtual void mouse_button_callback(GLFWwindow *window, int button, int action, int mods) = 0;
|
||||
|
||||
virtual void scroll_callback(GLFWwindow *window, double xoffset, double yoffset) = 0;
|
||||
virtual void scroll_callback(GLFWwindow *window, double xoffset, double yoffset) = 0;
|
||||
|
||||
virtual void joystick_callback(int jid, int event) = 0;
|
||||
virtual void joystick_callback(int jid, int event) = 0;
|
||||
|
||||
virtual void drop_callback(GLFWwindow *window, int count, const char **paths) = 0;
|
||||
virtual void drop_callback(GLFWwindow *window, int count, const char **paths) = 0;
|
||||
|
||||
virtual void window_close_callback(GLFWwindow *window) = 0;
|
||||
virtual void window_close_callback(GLFWwindow *window) = 0;
|
||||
|
||||
virtual void window_size_callback(GLFWwindow *window, int width, int height) = 0;
|
||||
virtual void window_size_callback(GLFWwindow *window, int width, int height) = 0;
|
||||
|
||||
virtual void framebuffer_size_callback(GLFWwindow *window, int width, int height) = 0;
|
||||
virtual void framebuffer_size_callback(GLFWwindow *window, int width, int height) = 0;
|
||||
|
||||
virtual void window_content_scale_callback(GLFWwindow *window, float xscale, float yscale) = 0;
|
||||
virtual void window_content_scale_callback(GLFWwindow *window, float xscale, float yscale) = 0;
|
||||
|
||||
virtual void window_pos_callback(GLFWwindow *window, int xpos, int ypos) = 0;
|
||||
virtual void window_pos_callback(GLFWwindow *window, int xpos, int ypos) = 0;
|
||||
|
||||
virtual void window_iconify_callback(GLFWwindow *window, int iconified) = 0;
|
||||
virtual void window_iconify_callback(GLFWwindow *window, int iconified) = 0;
|
||||
|
||||
virtual void window_maximize_callback(GLFWwindow *window, int maximized) = 0;
|
||||
virtual void window_maximize_callback(GLFWwindow *window, int maximized) = 0;
|
||||
|
||||
virtual void window_focus_callback(GLFWwindow *window, int focused) = 0;
|
||||
virtual void window_focus_callback(GLFWwindow *window, int focused) = 0;
|
||||
|
||||
virtual void window_refresh_callback(GLFWwindow *window) = 0;
|
||||
virtual void window_refresh_callback(GLFWwindow *window) = 0;
|
||||
|
||||
virtual void error_callback(int error, const char *message) = 0;
|
||||
};
|
||||
virtual void error_callback(int error, const char *message) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
10575
include/stb_image.h
10575
include/stb_image.h
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue