diff --git a/Graphics/private/Window.cpp b/Graphics/private/Window.cpp index 9456ca9..3c0bdf1 100644 --- a/Graphics/private/Window.cpp +++ b/Graphics/private/Window.cpp @@ -1,13 +1,10 @@ + #include "Window.hpp" #include "WindowContext.hpp" #include "Allocators.hpp" -// -------- OpenGL -------- // #include -// -------- Window Context -------- // -#include - #ifdef ENV_OS_WINDOWS #define GLFW_EXPOSE_NATIVE_WIN32 #endif @@ -16,9 +13,7 @@ #define GLFW_EXPOSE_NATIVE_WAYLAND #endif -#include - -#include +#include #include namespace tp { diff --git a/Graphics/public/Graphics.hpp b/Graphics/public/Graphics.hpp index e950471..7f26869 100644 --- a/Graphics/public/Graphics.hpp +++ b/Graphics/public/Graphics.hpp @@ -1,12 +1,13 @@ #pragma once +#include "Window.hpp" + #include "Color.hpp" #include "Rect.hpp" #include "Buffer.hpp" namespace tp { - class Window; class DebugGUI { class Context; diff --git a/Objects/applications/GUIEntry.cpp b/Objects/applications/GUIEntry.cpp index aecd300..74e84c5 100644 --- a/Objects/applications/GUIEntry.cpp +++ b/Objects/applications/GUIEntry.cpp @@ -1,45 +1,36 @@ -#include "Window.hpp" +#include "Graphics.hpp" #include "GUI.h" using namespace tp; using namespace obj; -class GUIWindow { - Window* window; - ObjectsGUI gui; - -public: - GUIWindow() { - tp::HeapAllocGlobal::startIgnore(); - window = Window::createWindow(1500, 900, "Objects GUI"); - tp::HeapAllocGlobal::stopIgnore(); - - gui.cd(NDO->create("dict"), "root"); - } - - void run() { - while (!window->shouldClose()) { - window->processEvents(); - gui.draw(); - window->draw(); - } - } - - ~GUIWindow() { Window::destroyWindow(window); } -}; - int main() { tp::ModuleManifest* deps[] = { &gModuleObjects, &gModuleGraphics, nullptr }; tp::ModuleManifest module("ObjectsTests", nullptr, nullptr, deps); if (module.initialize()) { + auto window = Window::createWindow({ 1500, 900 }, "Objects GUI"); + { - GUIWindow window; - window.run(); + Graphics graphics(window); + ObjectsGUI gui; + + gui.cd(NDO->create("dict"), "root"); + + while (!window->shouldClose()) { + window->processEvents(); + graphics.proc(); + gui.draw(); + graphics.draw(); + window->draw(); + } } + + Window::destroyWindow(window); + module.deinitialize(); } diff --git a/Widgets/examples/Entry.cpp b/Widgets/examples/Entry.cpp index 820945c..21410f9 100644 --- a/Widgets/examples/Entry.cpp +++ b/Widgets/examples/Entry.cpp @@ -1,13 +1,14 @@ #include "ExampleGUI.hpp" -#include "Window.hpp" + +#include "Graphics.hpp" using namespace tp; void runApp() { - auto window = tp::Window::createWindow(800, 600, "Window 1"); + auto window = tp::Window::createWindow({ 800, 600 }, "Window 1"); - tp::ComplexWidget gui; + tp::ComplexWidget gui; if (window) { while (!window->shouldClose()) {