Changeset c61323a in opengl-game for opengl-game.cpp
- Timestamp:
- Sep 13, 2019, 2:51:30 AM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 1fcca9e
- Parents:
- f6521fb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
opengl-game.cpp
rf6521fb rc61323a 57 57 58 58 void OpenGLGame::mainLoop() { 59 //MouseEvent e; 59 UIEvent e; 60 bool quit = false; 60 61 61 while (!glfwWindowShouldClose(window)) { 62 /* 62 while (!quit) { 63 63 gui->processEvents(); 64 64 65 if (gui->getKeyEvent(GLFW_KEY_ESCAPE) == RTWO_KEY_EVENT_PRESSED) { 66 glfwSetWindowShouldClose(window, 1); 67 } 68 69 while (gui->pollMouseEvent(&e)) { 70 cout << "Mouse click detected at (" << e.x << ", " << e.y << ")" << endl; 71 } 72 */ 73 74 glfwPollEvents(); 75 76 if (GameGui_GLFW::s_keyState[GLFW_KEY_ESCAPE] == GLFW_PRESS) { 77 glfwSetWindowShouldClose(window, 1); 65 while (gui->pollEvent(&e)) { 66 switch (e.type) { 67 case UI_EVENT_QUIT: 68 cout << "Quit event detected" << endl; 69 quit = true; 70 break; 71 case UI_EVENT_KEY: 72 if (e.key.keycode == GLFW_KEY_ESCAPE) { 73 quit = true; 74 } else { 75 cout << "Key event detected" << endl; 76 } 77 break; 78 default: 79 cout << "Unhandled UI event: " << e.type << endl; 80 } 78 81 } 79 82
Note:
See TracChangeset
for help on using the changeset viewer.