removing useless window owning in GuiData
This commit is contained in:
parent
9e4e6fa226
commit
420ad2c8d9
@ -12,6 +12,8 @@ namespace gui {
|
||||
|
||||
class GuiData;
|
||||
|
||||
class Window;
|
||||
|
||||
namespace menu { class MenuData; }
|
||||
|
||||
class Gui final {
|
||||
@ -43,7 +45,7 @@ namespace gui {
|
||||
public:
|
||||
Gui() = delete;
|
||||
|
||||
explicit Gui(GuiData &data, menu::MenuData &menuData);
|
||||
explicit Gui(Window &window, GuiData &data, menu::MenuData &menuData);
|
||||
|
||||
~Gui() noexcept;
|
||||
|
||||
|
@ -11,7 +11,6 @@ namespace character {
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
namespace gui {
|
||||
class Window;
|
||||
|
||||
enum class characChanged {
|
||||
None,
|
||||
@ -25,8 +24,6 @@ namespace gui {
|
||||
private:
|
||||
friend class Gui;
|
||||
|
||||
Window &window;
|
||||
|
||||
character::CharacterSheet &billy;
|
||||
|
||||
std::pair<characChanged, std::uint32_t> base{ characChanged::None, 0 };
|
||||
@ -47,12 +44,10 @@ namespace gui {
|
||||
|
||||
GuiData() = delete;
|
||||
|
||||
explicit GuiData(Window &wwindow, character::CharacterSheet &billy) : window(wwindow), billy(billy) { SPDLOG_DEBUG("Creating GUI Data"); }
|
||||
explicit GuiData(character::CharacterSheet &billy) noexcept: billy(billy) { SPDLOG_DEBUG("Creating GUI Data"); }
|
||||
|
||||
~GuiData() noexcept = default;
|
||||
|
||||
[[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; }
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include "character_sheet.hpp"
|
||||
#include "controller.hpp"
|
||||
|
||||
gui::Gui::Gui(GuiData &data, menu::MenuData &menuData) : data(data), menu(menuData), font("font/DejaVuSans.ttf") {
|
||||
gui::Gui::Gui(Window &window, GuiData &data, menu::MenuData &menuData) : data(data), menu(menuData), font("font/DejaVuSans.ttf") {
|
||||
SPDLOG_DEBUG("Creating GUI");
|
||||
(void) ImGui::CreateContext();
|
||||
ImGui::StyleColorsDark();
|
||||
(void) ImGui::GetIO().Fonts->AddFontFromFileTTF(font.c_str(), 18.0f);
|
||||
(void) ImGui_ImplGlfw_InitForOpenGL(data.get_window().get_window().get(), true);
|
||||
(void) ImGui_ImplGlfw_InitForOpenGL(window.get_window().get(), true);
|
||||
initialized = ImGui_ImplOpenGL3_Init("#version 130");
|
||||
SPDLOG_DEBUG("Initialized: {}", initialized);
|
||||
}
|
||||
|
@ -1,4 +1 @@
|
||||
#include "gui/gui_data.hpp"
|
||||
#include "gui/window.hpp"
|
||||
|
||||
gui::Window &gui::GuiData::get_window() const { return window; }
|
||||
|
@ -14,10 +14,10 @@ int main() {
|
||||
try {
|
||||
gui::Window window;
|
||||
character::CharacterSheet billy;
|
||||
gui::GuiData gui_data(window, billy);
|
||||
gui::GuiData gui_data(billy);
|
||||
gui::menu::MenuData menu_data(billy);
|
||||
Controller controller(billy, menu_data);
|
||||
gui::Gui gui(gui_data, menu_data);
|
||||
gui::Gui gui(window, gui_data, menu_data);
|
||||
|
||||
while (!window.should_close()) {
|
||||
glfwPollEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user