From bfbdd0e33b88acc6d2cb92fa27136e4bc720aec2 Mon Sep 17 00:00:00 2001 From: IlyaShurupov Date: Wed, 20 Mar 2024 10:05:57 +0300 Subject: [PATCH] osg stable --- Objects/applications/GUIEntry.cpp | 39 +++++++++++++++++-------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Objects/applications/GUIEntry.cpp b/Objects/applications/GUIEntry.cpp index 74e84c5..6c574c9 100644 --- a/Objects/applications/GUIEntry.cpp +++ b/Objects/applications/GUIEntry.cpp @@ -1,36 +1,39 @@ -#include "Graphics.hpp" +#include "GraphicApplication.hpp" #include "GUI.h" using namespace tp; using namespace obj; +class ExampleGUI : public Application { +public: + ExampleGUI() { + gui.cd(NDO->create("dict"), "root"); + } + + void processFrame(EventHandler* eventHandler) override { + } + + void drawFrame(Canvas* canvas) override { + canvas->rect({ { 0, 0 }, mWindow->getSize() }, RGBA(0.f, 0.f, 0.f, 1.f), 0); + gui.draw(); + } + +private: + ObjectsGUI gui; +}; + 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"); - { - Graphics graphics(window); - ObjectsGUI gui; - - gui.cd(NDO->create("dict"), "root"); - - while (!window->shouldClose()) { - window->processEvents(); - graphics.proc(); - gui.draw(); - graphics.draw(); - window->draw(); - } + ExampleGUI gui; + gui.run(); } - - Window::destroyWindow(window); - module.deinitialize(); }