test window module

This commit is contained in:
2025-03-16 23:17:00 -05:00
parent 453e9f2aee
commit 0e6fcc9546
4 changed files with 26 additions and 6 deletions

View File

@@ -8,12 +8,25 @@ Window::Window() {
std::abort(); std::abort();
} }
w = glfwCreateWindow(640, 480, "Archimedes", NULL, NULL); w = glfwCreateWindow(640, 480, "Archimedes", NULL, NULL);
if(!w) {
glfwTerminate();
std::abort();
}
glfwMakeContextCurrent(w);
} }
bool Window::close() { bool Window::shouldClose() {
return glfwShouldClose(w); return glfwShouldClose(w);
} }
Window::~Window() { void Window::doFrame() {
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(w);
glfwPollEvents();
}
Window::~Window() {
glfwTerminate();
} }

View File

@@ -9,7 +9,9 @@ class Window {
Window(); Window();
~Window(); ~Window();
bool close(); bool shouldClose();
void doFrame();
private: private:
GLFWwindow* w; GLFWwindow* w;

View File

@@ -8,4 +8,9 @@ WindowModule::~WindowModule() {}
void WindowModule::run() { void WindowModule::run() {
if(window.shouldClose()) {
app.stopModule(self);
}
window.doFrame();
} }

View File

@@ -1,5 +1,5 @@
#include "Archimedes.h" #include "Archimedes.h"
#include "WindowImpl/WindowImpl.h" #include "WindowImpl/GLFW/windowGLFW.h"
#include "Renderer/Renderer.h" #include "Renderer/Renderer.h"
class WindowModule : public Module { class WindowModule : public Module {
@@ -13,7 +13,7 @@ class WindowModule : public Module {
private: private:
WindowImpl window; Window window;
Renderer renderer; Renderer renderer;
}; };