Changeset 8667f76 in opengl-game
- Timestamp:
- Jul 19, 2019, 9:49:52 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 80edd70
- Parents:
- 0e6ecf3
- git-author:
- Dmitry Portnoy <dmitry.portnoy@…> (07/19/19 21:45:27)
- git-committer:
- Dmitry Portnoy <dmitry.portnoy@…> (07/19/19 21:49:52)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
game-gui-glfw.cpp
r0e6ecf3 r8667f76 26 26 RTWO_SUCCESS : RTWO_ERROR; 27 27 } 28 29 vector<const char*> GameGui_GLFW::GetRequiredExtensions() { 30 uint32_t glfwExtensionCount = 0; 31 const char** glfwExtensions; 32 33 glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount); 34 35 vector<const char*> extensions(glfwExtensions, glfwExtensions + glfwExtensionCount); 36 37 return extensions; 38 } 39 40 void GameGui_GLFW::GetWindowSize(int* width, int* height) { 41 glfwGetFramebufferSize(window, width, height); 42 } -
game-gui-glfw.hpp
r0e6ecf3 r8667f76 16 16 17 17 bool CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface); 18 vector<const char*> GetRequiredExtensions(); 19 void GetWindowSize(int* width, int* height); 18 20 19 21 private: -
game-gui-sdl.cpp
r0e6ecf3 r8667f76 37 37 RTWO_SUCCESS : RTWO_ERROR; 38 38 } 39 40 vector<const char*> GameGui_SDL::GetRequiredExtensions() { 41 uint32_t extensionCount = 0; 42 SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, nullptr); 43 44 vector<const char*> extensions(extensionCount); 45 SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, extensions.data()); 46 47 return extensions; 48 } 49 50 void GameGui_SDL::GetWindowSize(int* width, int* height) { 51 SDL_GetWindowSize(window, width, height); 52 } -
game-gui-sdl.hpp
r0e6ecf3 r8667f76 16 16 17 17 bool CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface); 18 vector<const char*> GetRequiredExtensions(); 19 void GetWindowSize(int* width, int* height); 18 20 19 21 private: -
game-gui.hpp
r0e6ecf3 r8667f76 5 5 6 6 #include <string> 7 #include <vector> 7 8 8 9 using namespace std; … … 21 22 virtual void DestroyWindow() = 0; 22 23 23 virtual bool CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0; 24 virtual bool CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0; 25 virtual vector<const char*> GetRequiredExtensions() = 0; 26 virtual void GetWindowSize(int* width, int* height) = 0; 24 27 }; 25 28 -
vulkan-game.cpp
r0e6ecf3 r8667f76 14 14 #include <optional> 15 15 #include <set> 16 #include <vector>17 16 18 17 using namespace std; … … 125 124 bool framebufferResized = false; 126 125 127 // both SDL and GLFW create window functions return NULL on failure128 126 bool initWindow() { 129 127 if (gui->Init() == RTWO_ERROR) { … … 160 158 void recreateSwapChain() { 161 159 int width = 0, height = 0; 162 SDL_GetWindowSize(window,&width, &height);160 gui->GetWindowSize(&width, &height); 163 161 164 162 while (width == 0 || height == 0 || 165 163 (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) != 0) { 166 164 SDL_WaitEvent(nullptr); 167 SDL_GetWindowSize(window,&width, &height);165 gui->GetWindowSize(&width, &height); 168 166 } 169 167 … … 219 217 createInfo.ppEnabledExtensionNames = extensions.data(); 220 218 221 cout << endl << " SDL extensions:" << endl;219 cout << endl << "Extensions:" << endl; 222 220 for (const char* extensionName : extensions) { 223 221 cout << extensionName << endl; … … 488 486 } else { 489 487 int width, height; 490 SDL_GetWindowSize(window,&width, &height);488 gui->GetWindowSize(&width, &height); 491 489 492 490 VkExtent2D actualExtent = { … … 511 509 512 510 vector<const char*> getRequiredExtensions() { 513 uint32_t extensionCount = 0; 514 SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, nullptr); 515 516 vector<const char*> extensions(extensionCount); 517 SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, extensions.data()); 511 vector<const char*> extensions = gui->GetRequiredExtensions(); 518 512 519 513 if (enableValidationLayers) {
Note:
See TracChangeset
for help on using the changeset viewer.