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);