From dc8ad2d7f67e47b00ed0ecb77fae976275fc7a16 Mon Sep 17 00:00:00 2001 From: Schark Date: Thu, 11 May 2023 22:42:54 -0700 Subject: Fullscreen, for now --- src/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 180c955..0ea84d4 100644 --- a/src/main.c +++ b/src/main.c @@ -35,9 +35,9 @@ typedef struct { } ColorRGB; // honest- this function can from chatgpt- cross-reference this with other raycasting guides -void raycast(Player *player) { - int screen_width = 800; - int screen_height = 600; +void raycast(Player *player, int width, int height) { + int screen_width = width; + int screen_height = height; for (int x = 0; x < screen_width; ++x) { // Calculate ray position and direction @@ -173,7 +173,10 @@ int main(int argc, char *argv[]) { } // create glfw window - window = glfwCreateWindow(800, 600, "raycaster", NULL, NULL); + GLFWmonitor* primary = glfwGetPrimaryMonitor(); + const GLFWvidmode* mode = glfwGetVideoMode(primary); + //window = glfwCreateWindow(800, 600, "raycaster", NULL, NULL); + window = glfwCreateWindow(mode->width, mode->height, "raycaster", primary, NULL); if (!window){ printf("Failed to create GLFW window.\n"); glfwTerminate(); @@ -186,7 +189,7 @@ int main(int argc, char *argv[]) { // setup orthographic projection camera glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0.0, 800, 600, 0.0, -1.0, 1.0); + glOrtho(0.0, mode->width, mode->height, 0.0, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); // TODO: move timers into a header @@ -212,7 +215,7 @@ int main(int argc, char *argv[]) { glLoadIdentity(); // main raycast function - raycast(&player); + raycast(&player, mode->width, mode->height); move_player(&player, window); glfwSwapBuffers(window); -- cgit v1.2.3-18-g5258