the gui problem^TM

This commit is contained in:
2025-03-21 16:16:25 -05:00
parent 7900def444
commit 6b8861a7fb
15 changed files with 316 additions and 206 deletions

View File

@@ -0,0 +1,37 @@
#include "Archimedes.h"
#include "WindowGLFW.h"
namespace Archimedes {
WindowGLFW::WindowGLFW() {
glfwSetErrorCallback([](int e, const char* m){
std::cout << "GLFW Error: " << m << std::endl;
});
if(!glfwInit()) {
std::cout << "glfwInit failed!\n";
std::abort();
}
w = glfwCreateWindow(640, 480, "Archimedes", NULL, NULL);
if(!w) {
glfwTerminate();
std::abort();
}
glfwMakeContextCurrent(w);
glfwSwapInterval(1);
}
bool WindowGLFW::shouldClose() {
return glfwWindowShouldClose(w);
}
void WindowGLFW::doFrame() {
glfwPollEvents();
glfwSwapBuffers(w);
}
WindowGLFW::~WindowGLFW() {
glfwTerminate();
}
}

View File

@@ -0,0 +1,27 @@
#include "Archimedes.h"
#include <GLFW/glfw3.h>
namespace Archimedes {
class WindowGLFW {
public:
WindowGLFW();
~WindowGLFW();
bool shouldClose();
void doFrame();
void getSize(int&, int&);
auto getWindow() { return w; }
private:
GLFWwindow* w;
};
typedef WindowGLFW WindowImpl;
}