1 Commits

Author SHA1 Message Date
hans 7d3f394dcf Added c resize window function
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
2026-09-02 13:26:14 +02:00
+14 -1
View File
@@ -469,6 +469,11 @@ void display()
glutSwapBuffers(); glutSwapBuffers();
} }
void resize(int w, int h)
{
glutReshapeWindow(1024, 512);
}
// * Check for key presses and move the "player" accordingly // * Check for key presses and move the "player" accordingly
void buttons(unsigned char key, int x, int y) void buttons(unsigned char key, int x, int y)
{ {
@@ -552,7 +557,12 @@ int main(int argc, char *argv[])
{ {
glutInit(&argc, argv); glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); 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"); glutCreateWindow("Raycaster");
init(); init();
@@ -560,6 +570,9 @@ int main(int argc, char *argv[])
// Send display parameters to the display function // Send display parameters to the display function
glutDisplayFunc(display); glutDisplayFunc(display);
// Handle window resizes
glutReshapeFunc(resize);
// Send key presses to the keyboard function // Send key presses to the keyboard function
glutKeyboardFunc(buttons); glutKeyboardFunc(buttons);