From 01f2acca60a3a22b5e6d860a626d9d3a6f80c046 Mon Sep 17 00:00:00 2001 From: rich Date: Mon, 13 Jan 2025 10:24:35 -0500 Subject: [PATCH] changed to use smart pointer for window handle --- test.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test.cpp b/test.cpp index 68f60e4..a8dd5f3 100644 --- a/test.cpp +++ b/test.cpp @@ -5,9 +5,13 @@ #include #include -class TestWindow : public ReWindow::RWindow { +#define WIDTH 800 +#define HEIGHT 600 + + +class RandomWalkerWindow : public ReWindow::RWindow { public: - TestWindow(const std::string& title, int width, int height) + RandomWalkerWindow(const std::string& title, int width, int height) : ReWindow::RWindow(title, width, height) {} void OnRefresh(float elapsed) override { @@ -18,7 +22,10 @@ public: }; int main() { - auto* window = new TestWindow("Test Window", 800, 600); + + std::unique_ptr window = + std::make_unique("Random Walker with ReWindow", WIDTH, HEIGHT); + window->SetRenderer(RenderingAPI::OPENGL); window->Open(); @@ -26,6 +33,5 @@ int main() { window->ManagedRefresh(); } - delete window; return 0; }