Submodule for JSON added.

Menu data and menu in their own folder.
This commit is contained in:
Pcornat 2022-01-14 22:06:07 +01:00
parent 27c571a6b9
commit 9142896237
Signed by: Pcornat
GPG key ID: 2F3932FF46D9ECA0
12 changed files with 106 additions and 60 deletions

View file

@ -2,7 +2,7 @@
#define BILLYSHEET_GUI_HPP
#include <filesystem>
#include "menu.hpp"
#include "gui/menu/menu.hpp"
namespace fs = std::filesystem;
@ -10,11 +10,13 @@ namespace gui {
class GuiData;
namespace menu { class MenuData; }
class Gui final {
private:
GuiData &data;
Menu menu;
menu::Menu menu;
fs::path font;
@ -22,7 +24,7 @@ namespace gui {
public:
Gui() = delete;
explicit Gui(GuiData &data);
explicit Gui(GuiData &data, menu::MenuData &menuData);
~Gui() noexcept;

View file

@ -2,32 +2,28 @@
#define BILLYSHEET_GUI_DATA_HPP
#include "character_sheet.hpp"
#include <filesystem>
#include <spdlog/spdlog.h>
namespace fs = std::filesystem;
namespace gui {
class Window;
class GuiData final {
private:
friend class Gui;
Window &window;
character::CharacterSheet billy;
// Is it the right place here for both ? Not sure.
fs::path save_path{ "./" };
std::string filename{ "character_sheet.json" };
public:
GuiData() = delete;
explicit GuiData(Window &wwindow) : window(wwindow) { SPDLOG_DEBUG("Creating GUI Data"); }
[[nodiscard]] Window &get_window() const;
~GuiData() noexcept = default;
[[nodiscard]] Window &get_window() const;
};
}

View file

@ -1,24 +0,0 @@
#ifndef BILLYSHEET_MENU_HPP
#define BILLYSHEET_MENU_HPP
#include <spdlog/spdlog.h>
namespace gui {
class GuiData;
class Menu final {
private:
GuiData &data;
public:
Menu() noexcept = delete;
explicit Menu(GuiData &data) noexcept: data(data) { SPDLOG_DEBUG("Creating Menu"); }
~Menu() noexcept = default;
void gui() const noexcept;
};
}
#endif //BILLYSHEET_MENU_HPP

30
include/gui/menu/menu.hpp Normal file
View file

@ -0,0 +1,30 @@
#ifndef BILLYSHEET_MENU_HPP
#define BILLYSHEET_MENU_HPP
#include <spdlog/spdlog.h>
namespace gui {
class GuiData;
namespace menu {
class MenuData;
class Menu final {
private:
MenuData &data;
public:
Menu() noexcept = delete;
explicit Menu(MenuData &data) noexcept: data(data) { SPDLOG_DEBUG("Creating Menu"); }
~Menu() noexcept = default;
void gui() const noexcept;
[[nodiscard]] const MenuData &get_data() const { return data; }
};
}
}
#endif //BILLYSHEET_MENU_HPP

View file

@ -0,0 +1,28 @@
#ifndef BILLYSHEET_MENU_DATA_HPP
#define BILLYSHEET_MENU_DATA_HPP
#include <filesystem>
namespace fs = std::filesystem;
namespace gui::menu {
class MenuData final {
private:
friend class Menu;
fs::path save_path{ "./" };
std::string filename{ "character_sheet.json" };
bool edit_mode{ true };
public:
MenuData() noexcept = default;
~MenuData() noexcept = default;
[[nodiscard]] bool is_edit_mode() const { return edit_mode; }
};
}
#endif //BILLYSHEET_MENU_DATA_HPP