This commit is contained in:
IlyaShurupov 2024-03-19 11:52:22 +03:00 committed by Ilya Shurupov
parent 84046e89be
commit 25fd52294f
4 changed files with 26 additions and 38 deletions

View file

@ -1,13 +1,10 @@
#include "Window.hpp"
#include "WindowContext.hpp"
#include "Allocators.hpp"
// -------- OpenGL -------- //
#include <GL/glew.h>
// -------- Window Context -------- //
#include <GLFW/glfw3.h>
#ifdef ENV_OS_WINDOWS
#define GLFW_EXPOSE_NATIVE_WIN32
#endif
@ -16,9 +13,7 @@
#define GLFW_EXPOSE_NATIVE_WAYLAND
#endif
#include <GLFW/glfw3native.h>
#include <array>
#include <GLFW/glfw3.h>
#include <cstdio>
namespace tp {

View file

@ -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;

View file

@ -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();
}

View file

@ -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<tp::Window::Events, tp::Graphics::Canvas> gui;
tp::ComplexWidget<tp::EventHandler, tp::Canvas> gui;
if (window) {
while (!window->shouldClose()) {