From 955ffb0d4a0235532fdb9b808745bcf571735122 Mon Sep 17 00:00:00 2001 From: Aaditya Dhruv Date: Sun, 25 Jan 2026 18:06:13 -0600 Subject: rotating cube --- src/junkcraft.c | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) (limited to 'src/junkcraft.c') diff --git a/src/junkcraft.c b/src/junkcraft.c index d914973..e96b942 100644 --- a/src/junkcraft.c +++ b/src/junkcraft.c @@ -1,44 +1,11 @@ -#include -#include -#include -#include -#include -#include "SDL2/SDL_render.h" -#include "glad/glad.h" -#include "shader.h" -#include "block.h" -#include "window.h" - -// Global OpenGL Context -GLuint shader_program; -int game_loop = 1; - -void draw(struct window* window, struct block* block) { - while (game_loop) { - SDL_Event event; - while (SDL_PollEvent(&event)) { - // Quit game - if (event.type == SDL_QUIT) { - game_loop = 0; - } - } - glClear(GL_COLOR_BUFFER_BIT); - glUseProgram(shader_program); - block_draw(block); - SDL_RenderPresent(window->renderer); - } -} +#include "engine.h" int main() { - struct window window = {0}; - if (window_init(&window) != 0) { + struct engine engine = { 0 }; + if (engine_init(&engine) != 0) { return -1; } - struct block blk = {0}; - vec3 pos = { 0, 0, 0 }; - block_init(pos, &blk); - shader_program = shader_init(); - draw(&window, &blk); - window_cleanup(&window); + engine_draw(&engine); + window_cleanup(engine.window); return 0; } -- cgit