test window module
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ class Window {
|
|||||||
Window();
|
Window();
|
||||||
~Window();
|
~Window();
|
||||||
|
|
||||||
bool close();
|
bool shouldClose();
|
||||||
|
|
||||||
|
void doFrame();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLFWwindow* w;
|
GLFWwindow* w;
|
||||||
|
|||||||
@@ -8,4 +8,9 @@ WindowModule::~WindowModule() {}
|
|||||||
|
|
||||||
void WindowModule::run() {
|
void WindowModule::run() {
|
||||||
|
|
||||||
|
if(window.shouldClose()) {
|
||||||
|
app.stopModule(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.doFrame();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user