Always functional.
Design : the controller controls data of the character sheet and also saving and reading data.
This commit is contained in:
parent
84450d25af
commit
b759836989
16 changed files with 8011 additions and 23 deletions
|
@ -15,6 +15,8 @@ namespace character {
|
|||
class CharacterSheet final {
|
||||
private:
|
||||
friend gui::Gui;
|
||||
friend class Controller;
|
||||
|
||||
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
|
||||
|
||||
std::string caractere{};
|
||||
|
@ -62,7 +64,7 @@ namespace character {
|
|||
[[nodiscard]] std::uint32_t get_money() const { return money; }
|
||||
|
||||
friend void from_json(const json &j, CharacterSheet &billy) {
|
||||
j.at("caracters").get_to(billy.caractere);
|
||||
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);
|
||||
|
|
|
@ -1,9 +1,27 @@
|
|||
#ifndef BILLYSHEET_CONTROLLER_HPP
|
||||
#define BILLYSHEET_CONTROLLER_HPP
|
||||
|
||||
namespace character {
|
||||
class CharacterSheet;
|
||||
}
|
||||
|
||||
class Controller {
|
||||
namespace gui::menu {
|
||||
class MenuData;
|
||||
}
|
||||
|
||||
class Controller final {
|
||||
private:
|
||||
character::CharacterSheet &sheet;
|
||||
const gui::menu::MenuData &menu_data;
|
||||
|
||||
public:
|
||||
Controller() = delete;
|
||||
|
||||
explicit Controller(character::CharacterSheet &sheet, const gui::menu::MenuData &menuData) : sheet(sheet), menu_data(menuData) {}
|
||||
|
||||
~Controller() noexcept = default;
|
||||
|
||||
void control() noexcept;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#ifndef BILLYSHEET_GUI_DATA_HPP
|
||||
#define BILLYSHEET_GUI_DATA_HPP
|
||||
|
||||
#include "character_sheet.hpp"
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace character {
|
||||
class CharacterSheet;
|
||||
}
|
||||
|
||||
namespace gui {
|
||||
class Window;
|
||||
|
||||
|
@ -13,13 +16,12 @@ namespace gui {
|
|||
|
||||
Window &window;
|
||||
|
||||
character::CharacterSheet billy;
|
||||
|
||||
character::CharacterSheet &billy;
|
||||
|
||||
public:
|
||||
GuiData() = delete;
|
||||
|
||||
explicit GuiData(Window &wwindow) : window(wwindow) { SPDLOG_DEBUG("Creating GUI Data"); }
|
||||
explicit GuiData(Window &wwindow, character::CharacterSheet &billy) : window(wwindow), billy(billy) { SPDLOG_DEBUG("Creating GUI Data"); }
|
||||
|
||||
~GuiData() noexcept = default;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace gui {
|
|||
public:
|
||||
Menu() noexcept = delete;
|
||||
|
||||
explicit Menu(MenuData &data) noexcept: data(data) { SPDLOG_DEBUG("Creating Menu"); }
|
||||
explicit Menu(MenuData &data) noexcept;
|
||||
|
||||
~Menu() noexcept = default;
|
||||
|
||||
|
|
|
@ -5,18 +5,26 @@
|
|||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace character {
|
||||
class CharacterSheet;
|
||||
}
|
||||
|
||||
namespace gui::menu {
|
||||
class MenuData final {
|
||||
private:
|
||||
friend class Menu;
|
||||
|
||||
const character::CharacterSheet &character_sheet;
|
||||
|
||||
fs::path save_path{ "./" };
|
||||
|
||||
std::string filename{ "character_sheet.json" };
|
||||
|
||||
bool edit_mode{ true };
|
||||
public:
|
||||
MenuData() noexcept = default;
|
||||
MenuData() noexcept = delete;
|
||||
|
||||
explicit MenuData(const character::CharacterSheet &characterSheet) noexcept: character_sheet(characterSheet) {}
|
||||
|
||||
~MenuData() noexcept = default;
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#ifndef BILLYSHEET_WINDOW_HPP
|
||||
#define BILLYSHEET_WINDOW_HPP
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <memory>
|
||||
#include "imgui_impl_opengl3_loader.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
|
||||
namespace gui {
|
||||
class Window final {
|
||||
|
|
7897
include/stb_image.h
Normal file
7897
include/stb_image.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue