From 7d3f394dcf25bc476f57c838df54c05a50942968 Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Wed, 2 Sep 2026 13:26:14 +0200 Subject: [PATCH] Added c resize window function Signed-off-by: Hans Kokx --- raycaster.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/raycaster.c b/raycaster.c index dc4ef67..4fade83 100644 --- a/raycaster.c +++ b/raycaster.c @@ -469,6 +469,11 @@ void display() glutSwapBuffers(); } +void resize(int w, int h) +{ + glutReshapeWindow(1024, 512); +} + // * Check for key presses and move the "player" accordingly void buttons(unsigned char key, int x, int y) { @@ -552,7 +557,12 @@ int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); - glutInitWindowSize(TOTAL_WIDTH, TOTAL_HEIGHT); + // glutInitWindowSize(TOTAL_WIDTH, TOTAL_HEIGHT); + glutInitWindowSize(1024, 510); + + // Initialize the window to the center of the screen + glutInitWindowPosition(200, 200); + glutCreateWindow("Raycaster"); init(); @@ -560,6 +570,9 @@ int main(int argc, char *argv[]) // Send display parameters to the display function glutDisplayFunc(display); + // Handle window resizes + glutReshapeFunc(resize); + // Send key presses to the keyboard function glutKeyboardFunc(buttons);