diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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); |