rename program to WindowSystem and move

This commit is contained in:
Benjamin Palko 2024-10-06 22:18:51 -04:00
parent 7be0ef8692
commit 6d980ee4ec
5 changed files with 16 additions and 10 deletions

View file

@ -2,7 +2,7 @@
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <fmt/core.h> #include <fmt/core.h>
#include "program.hpp" #include "systems/window-system.hpp"
void error_callback(int error_code, const char *description) { void error_callback(int error_code, const char *description) {
fmt::print("[ERROR - {}] {}\n", error_code, description); fmt::print("[ERROR - {}] {}\n", error_code, description);
@ -54,7 +54,7 @@ int main() {
} }
ShaderSystem shaderSystem = ShaderSystem(); ShaderSystem shaderSystem = ShaderSystem();
Program program = Program(window, shaderSystem); WindowSystem program = WindowSystem(window, shaderSystem);
program.Loop(); program.Loop();

View file

@ -1,2 +1,2 @@
sources = files('main.cpp', 'program.cpp', 'program.hpp') sources = files('main.cpp')
subdir('systems') subdir('systems')

View file

@ -1 +1,6 @@
sources += files('shader-system.cpp', 'shader-system.hpp') sources += files(
'shader-system.cpp',
'shader-system.hpp',
'window-system.cpp',
'window-system.hpp',
)

View file

@ -1,11 +1,12 @@
#include "program.hpp" #include "window-system.hpp"
Program::Program(GLFWwindow *window, class ShaderSystem shaderSystem) { WindowSystem::WindowSystem(GLFWwindow *window,
class ShaderSystem shaderSystem) {
this->window = window; this->window = window;
this->shaderSystem = shaderSystem; this->shaderSystem = shaderSystem;
} }
int Program::Loop() { int WindowSystem::Loop() {
while (!glfwWindowShouldClose(window)) { while (!glfwWindowShouldClose(window)) {
int width, height; int width, height;
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);

View file

@ -1,12 +1,12 @@
#define GLFW_INCLUDE_NONE #define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include "systems/shader-system.hpp" #include "shader-system.hpp"
class Program { class WindowSystem {
GLFWwindow *window; GLFWwindow *window;
ShaderSystem shaderSystem; ShaderSystem shaderSystem;
public: public:
Program(GLFWwindow *window, class ShaderSystem shaderSystem); WindowSystem(GLFWwindow *window, class ShaderSystem shaderSystem);
int Loop(); int Loop();
}; };