Changeset b6e60b4 in opengl-game
- Timestamp:
- Sep 3, 2019, 7:11:36 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- ed7c953
- Parents:
- 7fc5e27
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
opengl-game.cpp
r7fc5e27 rb6e60b4 17 17 } 18 18 19 void OpenGLGame::run( unsigned int width, unsignedint height, unsigned char guiFlags) {19 void OpenGLGame::run(int width, int height, unsigned char guiFlags) { 20 20 if (initWindow(width, height, guiFlags) == RTWO_ERROR) { 21 21 return; 22 22 } 23 23 24 initOpenGL(); 24 25 mainLoop(); … … 26 27 } 27 28 28 bool OpenGLGame::initWindow( unsigned int width, unsignedint height, unsigned char guiFlags) {29 bool OpenGLGame::initWindow(int width, int height, unsigned char guiFlags) { 29 30 gui = new GameGui_GLFW(); 30 31 31 if (gui-> Init() == RTWO_ERROR) {32 if (gui->init() == RTWO_ERROR) { 32 33 cout << "UI library could not be initialized!" << endl; 33 cout << gui-> GetError() << endl;34 cout << gui->getError() << endl; 34 35 return RTWO_ERROR; 35 36 } 36 37 cout << "GUI init succeeded" << endl; 37 38 38 window = (GLFWwindow*) gui-> CreateWindow("OpenGL Game", width, height, guiFlags |GUI_FLAGS_WINDOW_FULLSCREEN);39 window = (GLFWwindow*) gui->createWindow("OpenGL Game", width, height, guiFlags & GUI_FLAGS_WINDOW_FULLSCREEN); 39 40 if (window == nullptr) { 40 41 cout << "Window could not be created!" << endl; 41 42 return RTWO_ERROR; 42 43 } 44 45 int actualWidth=0, actualHeight=0; 46 gui->getWindowSize(&actualWidth, &actualHeight); 47 48 cout << "Target window size: (" << width << ", " << height << ")" << endl; 49 cout << "Actual window size: (" << actualWidth << ", " << actualHeight << ")" << endl; 43 50 44 51 return RTWO_SUCCESS; … … 61 68 62 69 void OpenGLGame::cleanup() { 63 gui-> DestroyWindow();64 gui-> Shutdown();70 gui->destroyWindow(); 71 gui->shutdown(); 65 72 delete gui; 66 73 } -
opengl-game.hpp
r7fc5e27 rb6e60b4 9 9 ~OpenGLGame(); 10 10 11 void run( unsigned int width, unsignedint height, unsigned char guiFlags);11 void run(int width, int height, unsigned char guiFlags); 12 12 13 13 private: … … 15 15 GLFWwindow* window; 16 16 17 bool initWindow( unsigned int width, unsignedint height, unsigned char guiFlags);17 bool initWindow(int width, int height, unsigned char guiFlags); 18 18 void initOpenGL(); 19 19 void mainLoop(); -
vulkan-game.cpp
r7fc5e27 rb6e60b4 18 18 } 19 19 20 void VulkanGame::run( unsigned int width, unsignedint height, unsigned char guiFlags) {20 void VulkanGame::run(int width, int height, unsigned char guiFlags) { 21 21 if (initWindow(width, height, guiFlags) == RTWO_ERROR) { 22 22 return; 23 23 } 24 24 25 initVulkan(); 25 26 mainLoop(); … … 27 28 } 28 29 29 bool VulkanGame::initWindow( unsigned int width, unsignedint height, unsigned char guiFlags) {30 bool VulkanGame::initWindow(int width, int height, unsigned char guiFlags) { 30 31 gui = new GameGui_SDL(); 31 32 32 if (gui-> Init() == RTWO_ERROR) {33 if (gui->init() == RTWO_ERROR) { 33 34 cout << "UI library could not be initialized!" << endl; 34 cout << gui-> GetError() << endl;35 cout << gui->getError() << endl; 35 36 return RTWO_ERROR; 36 37 } 37 cout << "GUI init succeeded" << endl;38 38 39 window = (SDL_Window*) gui-> CreateWindow("Vulkan Game", width, height, guiFlags |GUI_FLAGS_WINDOW_FULLSCREEN);39 window = (SDL_Window*) gui->createWindow("Vulkan Game", width, height, guiFlags & GUI_FLAGS_WINDOW_FULLSCREEN); 40 40 if (window == nullptr) { 41 41 cout << "Window could not be created!" << endl; 42 42 return RTWO_ERROR; 43 43 } 44 45 int actualWidth, actualHeight; 46 gui->getWindowSize(&actualWidth, &actualHeight); 47 48 cout << "Target window size: (" << width << ", " << height << ")" << endl; 49 cout << "Actual window size: (" << actualWidth << ", " << actualHeight << ")" << endl; 44 50 45 51 return RTWO_SUCCESS; … … 69 75 70 76 void VulkanGame::cleanup() { 71 gui-> DestroyWindow();72 gui-> Shutdown();77 gui->destroyWindow(); 78 gui->shutdown(); 73 79 delete gui; 74 80 } -
vulkan-game.hpp
r7fc5e27 rb6e60b4 9 9 ~VulkanGame(); 10 10 11 void run( unsigned int width, unsignedint height, unsigned char guiFlags);11 void run(int width, int height, unsigned char guiFlags); 12 12 13 13 private: … … 15 15 SDL_Window* window; 16 16 17 bool initWindow( unsigned int width, unsignedint height, unsigned char guiFlags);17 bool initWindow(int width, int height, unsigned char guiFlags); 18 18 void initVulkan(); 19 19 void mainLoop();
Note:
See TracChangeset
for help on using the changeset viewer.