Added c resize window function
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
+14
-1
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user