Changeset ea2b4dc in opengl-game
- Timestamp:
- Feb 14, 2021, 4:24:08 AM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 880cfc2
- Parents:
- 1cb64e6
- git-author:
- Dmitry Portnoy <dportnoy@…> (02/14/21 04:23:03)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (02/14/21 04:24:08)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r1cb64e6 rea2b4dc 8 8 9 9 #include "IMGUI/imgui_impl_sdl.h" 10 #include "IMGUI/imgui_impl_vulkan.h"11 10 12 11 #include "logger.hpp" … … 945 944 sdlOverlayImage, graphicsQueue); 946 945 947 renderFrame(); 946 updateScene(); 947 948 ImGui_ImplVulkan_NewFrame(); 949 ImGui_ImplSDL2_NewFrame(this->window); 950 ImGui::NewFrame(); 951 952 { 953 ImGui::SetNextWindowSize(ImVec2(250, 35), ImGuiCond_Once); 954 ImGui::SetNextWindowPos(ImVec2(380, 10), ImGuiCond_Once); 955 ImGui::Begin("WndMenubar", NULL, 956 ImGuiWindowFlags_NoTitleBar | 957 ImGuiWindowFlags_NoResize | 958 ImGuiWindowFlags_NoMove); 959 ImGui::InvisibleButton("", ImVec2(155, 18)); 960 ImGui::SameLine(); 961 if (ImGui::Button("Main Menu")) { 962 cout << "Clicked on the main button" << endl; 963 //events.push(Event::GO_TO_MAIN_MENU); 964 } 965 ImGui::End(); 966 } 967 968 ImGui::Render(); 969 970 renderFrame(ImGui::GetDrawData()); 948 971 presentFrame(); 949 972 } … … 1687 1710 } 1688 1711 1689 void VulkanGame::renderFrame( ) {1712 void VulkanGame::renderFrame(ImDrawData* draw_data) { 1690 1713 VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(), 1691 1714 imageAcquiredSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex); … … 1704 1727 throw runtime_error("failed to reset fence!"); 1705 1728 } 1706 1707 updateScene();1708 1729 1709 1730 VKUTIL_CHECK_RESULT(vkResetCommandPool(device, commandPools[imageIndex], 0), … … 1737 1758 currentScreen->createRenderCommands(commandBuffers[imageIndex], imageIndex); 1738 1759 1739 /**********************************************************/ 1740 1741 ImGui_ImplVulkan_NewFrame(); 1742 ImGui_ImplSDL2_NewFrame(this->window); 1743 ImGui::NewFrame(); 1744 1745 { 1746 ImGui::SetNextWindowSize(ImVec2(250, 35), ImGuiCond_Once); 1747 ImGui::SetNextWindowPos(ImVec2(380, 10), ImGuiCond_Once); 1748 ImGui::Begin("WndMenubar", NULL, 1749 ImGuiWindowFlags_NoTitleBar | 1750 ImGuiWindowFlags_NoResize | 1751 ImGuiWindowFlags_NoMove); 1752 ImGui::InvisibleButton("", ImVec2(155, 18)); 1753 ImGui::SameLine(); 1754 if (ImGui::Button("Main Menu")) { 1755 cout << "Clicked on the main button" << endl; 1756 //events.push(Event::GO_TO_MAIN_MENU); 1757 } 1758 ImGui::End(); 1759 } 1760 1761 ImGui::Render(); 1762 ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), commandBuffers[imageIndex]); 1763 1764 /**********************************************************/ 1760 ImGui_ImplVulkan_RenderDrawData(draw_data, commandBuffers[imageIndex]); 1765 1761 1766 1762 vkCmdEndRenderPass(commandBuffers[imageIndex]); -
vulkan-game.hpp
r1cb64e6 rea2b4dc 17 17 #include <SDL2/SDL.h> 18 18 #include <SDL2/SDL_ttf.h> 19 20 #include "IMGUI/imgui_impl_vulkan.h" 19 21 20 22 #include "consts.hpp" … … 451 453 vector<VkDescriptorBufferInfo>& bufferInfoList); 452 454 453 void renderFrame( );455 void renderFrame(ImDrawData* draw_data); 454 456 void presentFrame(); 455 457
Note:
See TracChangeset
for help on using the changeset viewer.