Index: sdl-game.cpp
===================================================================
--- sdl-game.cpp	(revision 9c0a614cccc4e71b75dbd749218b1adb7fa608b8)
+++ sdl-game.cpp	(revision 4e2c709a2b53e4003dcc6c516f8d70b616fb8ff1)
@@ -31,110 +31,4 @@
    }
 }
-
-void VulkanGame::FrameRender(ImDrawData* draw_data) {
-   VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(),
-      imageAcquiredSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);
-
-   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
-      g_SwapChainRebuild = true;
-      return;
-   } else {
-      VKUTIL_CHECK_RESULT(result, "failed to acquire swap chain image!");
-   }
-
-   VKUTIL_CHECK_RESULT(vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()),
-      "failed waiting for fence!");
-
-   VKUTIL_CHECK_RESULT(vkResetFences(device, 1, &inFlightFences[imageIndex]),
-      "failed to reset fence!");
-
-   // START OF NEW CODE
-   // I don't have analogous code in vulkan-game right now because I record command buffers once
-   // before the render loop ever starts. I should change this
-
-   VKUTIL_CHECK_RESULT(vkResetCommandPool(device, commandPools[imageIndex], 0),
-      "failed to reset command pool!");
-
-   VkCommandBufferBeginInfo info = {};
-   info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
-   info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
-
-   VKUTIL_CHECK_RESULT(vkBeginCommandBuffer(commandBuffers[imageIndex], &info),
-      "failed to begin recording command buffer!");
-
-   VkRenderPassBeginInfo renderPassInfo = {};
-   renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
-   renderPassInfo.renderPass = renderPass;
-   renderPassInfo.framebuffer = swapChainFramebuffers[imageIndex];
-   renderPassInfo.renderArea.extent = swapChainExtent;
-
-   array<VkClearValue, 2> clearValues = {};
-   clearValues[0].color = { { 0.45f, 0.55f, 0.60f, 1.00f } };
-   clearValues[1].depthStencil = { 1.0f, 0 };
-
-   renderPassInfo.clearValueCount = static_cast<uint32_t>(clearValues.size());
-   renderPassInfo.pClearValues = clearValues.data();
-
-   vkCmdBeginRenderPass(commandBuffers[imageIndex], &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
-
-   // Record dear imgui primitives into command buffer
-   ImGui_ImplVulkan_RenderDrawData(draw_data, commandBuffers[imageIndex]);
-
-   // Submit command buffer
-   vkCmdEndRenderPass(commandBuffers[imageIndex]);
-
-   VKUTIL_CHECK_RESULT(vkEndCommandBuffer(commandBuffers[imageIndex]),
-      "failed to record command buffer!");
-
-   // END OF NEW CODE
-
-   VkSemaphore waitSemaphores[] = { imageAcquiredSemaphores[currentFrame] };
-   VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
-   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
-
-   VkSubmitInfo submitInfo = {};
-   submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
-   submitInfo.waitSemaphoreCount = 1;
-   submitInfo.pWaitSemaphores = waitSemaphores;
-   submitInfo.pWaitDstStageMask = &wait_stage;
-   submitInfo.commandBufferCount = 1;
-   submitInfo.pCommandBuffers = &commandBuffers[imageIndex];
-   submitInfo.signalSemaphoreCount = 1;
-   submitInfo.pSignalSemaphores = signalSemaphores;
-
-   VKUTIL_CHECK_RESULT(vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[imageIndex]),
-      "failed to submit draw command buffer!");
-}
-
-void VulkanGame::FramePresent() {
-   if (g_SwapChainRebuild)
-      return;
-
-   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
-
-   VkPresentInfoKHR presentInfo = {};
-   presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
-   presentInfo.waitSemaphoreCount = 1;
-   presentInfo.pWaitSemaphores = signalSemaphores;
-   presentInfo.swapchainCount = 1;
-   presentInfo.pSwapchains = &swapChain;
-   presentInfo.pImageIndices = &imageIndex;
-   presentInfo.pResults = nullptr;
-
-   VkResult result = vkQueuePresentKHR(presentQueue, &presentInfo);
-
-   // In vulkan-game, I also handle VK_SUBOPTIMAL_KHR and framebufferResized. g_SwapChainRebuild is kind of similar
-   // to framebufferResized, but not quite the same
-   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
-      g_SwapChainRebuild = true;
-      return;
-   } else if (result != VK_SUCCESS) {
-      throw runtime_error("failed to present swap chain image!");
-   }
-
-   currentFrame = (currentFrame + 1) % swapChainImageCount;
-}
-
-/********************************************* START OF NEW CODE *********************************************/
 
 VKAPI_ATTR VkBool32 VKAPI_CALL VulkanGame::debugCallback(
@@ -337,6 +231,6 @@
       const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
       if (!is_minimized) {
-         FrameRender(draw_data);
-         FramePresent();
+         renderFrame(draw_data);
+         presentFrame();
       }
    }
@@ -924,4 +818,110 @@
 }
 
+void VulkanGame::renderFrame(ImDrawData* draw_data) {
+   VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(),
+      imageAcquiredSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);
+
+   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
+      g_SwapChainRebuild = true;
+      return;
+   }
+   else {
+      VKUTIL_CHECK_RESULT(result, "failed to acquire swap chain image!");
+   }
+
+   VKUTIL_CHECK_RESULT(vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()),
+      "failed waiting for fence!");
+
+   VKUTIL_CHECK_RESULT(vkResetFences(device, 1, &inFlightFences[imageIndex]),
+      "failed to reset fence!");
+
+   // START OF NEW CODE
+   // I don't have analogous code in vulkan-game right now because I record command buffers once
+   // before the render loop ever starts. I should change this
+
+   VKUTIL_CHECK_RESULT(vkResetCommandPool(device, commandPools[imageIndex], 0),
+      "failed to reset command pool!");
+
+   VkCommandBufferBeginInfo info = {};
+   info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
+   info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
+
+   VKUTIL_CHECK_RESULT(vkBeginCommandBuffer(commandBuffers[imageIndex], &info),
+      "failed to begin recording command buffer!");
+
+   VkRenderPassBeginInfo renderPassInfo = {};
+   renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
+   renderPassInfo.renderPass = renderPass;
+   renderPassInfo.framebuffer = swapChainFramebuffers[imageIndex];
+   renderPassInfo.renderArea.extent = swapChainExtent;
+
+   array<VkClearValue, 2> clearValues = {};
+   clearValues[0].color = { { 0.45f, 0.55f, 0.60f, 1.00f } };
+   clearValues[1].depthStencil = { 1.0f, 0 };
+
+   renderPassInfo.clearValueCount = static_cast<uint32_t>(clearValues.size());
+   renderPassInfo.pClearValues = clearValues.data();
+
+   vkCmdBeginRenderPass(commandBuffers[imageIndex], &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
+
+   // Record dear imgui primitives into command buffer
+   ImGui_ImplVulkan_RenderDrawData(draw_data, commandBuffers[imageIndex]);
+
+   // Submit command buffer
+   vkCmdEndRenderPass(commandBuffers[imageIndex]);
+
+   VKUTIL_CHECK_RESULT(vkEndCommandBuffer(commandBuffers[imageIndex]),
+      "failed to record command buffer!");
+
+   // END OF NEW CODE
+
+   VkSemaphore waitSemaphores[] = { imageAcquiredSemaphores[currentFrame] };
+   VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
+   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
+
+   VkSubmitInfo submitInfo = {};
+   submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+   submitInfo.waitSemaphoreCount = 1;
+   submitInfo.pWaitSemaphores = waitSemaphores;
+   submitInfo.pWaitDstStageMask = &wait_stage;
+   submitInfo.commandBufferCount = 1;
+   submitInfo.pCommandBuffers = &commandBuffers[imageIndex];
+   submitInfo.signalSemaphoreCount = 1;
+   submitInfo.pSignalSemaphores = signalSemaphores;
+
+   VKUTIL_CHECK_RESULT(vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[imageIndex]),
+      "failed to submit draw command buffer!");
+}
+
+void VulkanGame::presentFrame() {
+   if (g_SwapChainRebuild)
+      return;
+
+   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
+
+   VkPresentInfoKHR presentInfo = {};
+   presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
+   presentInfo.waitSemaphoreCount = 1;
+   presentInfo.pWaitSemaphores = signalSemaphores;
+   presentInfo.swapchainCount = 1;
+   presentInfo.pSwapchains = &swapChain;
+   presentInfo.pImageIndices = &imageIndex;
+   presentInfo.pResults = nullptr;
+
+   VkResult result = vkQueuePresentKHR(presentQueue, &presentInfo);
+
+   // In vulkan-game, I also handle VK_SUBOPTIMAL_KHR and framebufferResized. g_SwapChainRebuild is kind of similar
+   // to framebufferResized, but not quite the same
+   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
+      g_SwapChainRebuild = true;
+      return;
+   }
+   else if (result != VK_SUCCESS) {
+      throw runtime_error("failed to present swap chain image!");
+   }
+
+   currentFrame = (currentFrame + 1) % swapChainImageCount;
+}
+
 void VulkanGame::recreateSwapChain() {
    if (vkDeviceWaitIdle(device) != VK_SUCCESS) {
@@ -977,4 +977,2 @@
    vkDestroySwapchainKHR(device, swapChain, nullptr);
 }
-
-/********************************************** END OF NEW CODE **********************************************/
Index: sdl-game.hpp
===================================================================
--- sdl-game.hpp	(revision 9c0a614cccc4e71b75dbd749218b1adb7fa608b8)
+++ sdl-game.hpp	(revision 4e2c709a2b53e4003dcc6c516f8d70b616fb8ff1)
@@ -111,4 +111,7 @@
       void createSyncObjects();
 
+      void renderFrame(ImDrawData* draw_data);
+      void presentFrame();
+
       void recreateSwapChain();
 
@@ -118,9 +121,4 @@
       VkDescriptorPool descriptorPool;
 
-   // Helper methods from imgui_impl_vulkan that were moved into VulkanGame to give them access to class instance variables
-   public:
-      void FrameRender(ImDrawData* draw_data);
-      void FramePresent();
-
 };
 
Index: vulkan-game.cpp
===================================================================
--- vulkan-game.cpp	(revision 9c0a614cccc4e71b75dbd749218b1adb7fa608b8)
+++ vulkan-game.cpp	(revision 4e2c709a2b53e4003dcc6c516f8d70b616fb8ff1)
@@ -942,5 +942,6 @@
          sdlOverlayImage, graphicsQueue);
 
-      renderScene();
+      renderFrame();
+      presentFrame();
    }
 }
@@ -1139,66 +1140,4 @@
 }
 
-// TODO: Maybe move all/most of this to the base Screen class
-void VulkanGame::renderScene() {
-   // TODO: Recreate the swap chain here if the user went to a new screen
-
-   VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(),
-      imageAcquiredSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);
-
-   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
-      recreateSwapChain();
-      return;
-   } else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
-      throw runtime_error("failed to acquire swap chain image!");
-   }
-
-   if (vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()) != VK_SUCCESS) {
-      throw runtime_error("failed waiting for fence!");
-   }
-   if (vkResetFences(device, 1, &inFlightFences[imageIndex]) != VK_SUCCESS) {
-      throw runtime_error("failed to reset fence!");
-   }
-
-   updateScene();
-
-   VkSemaphore waitSemaphores[] = { imageAcquiredSemaphores[currentFrame] };
-   VkPipelineStageFlags waitStages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
-   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
-
-   VkSubmitInfo submitInfo = {};
-   submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
-   submitInfo.waitSemaphoreCount = 1;
-   submitInfo.pWaitSemaphores = waitSemaphores;
-   submitInfo.pWaitDstStageMask = waitStages;
-   submitInfo.commandBufferCount = 1;
-   submitInfo.pCommandBuffers = &commandBuffers[imageIndex];
-   submitInfo.signalSemaphoreCount = 1;
-   submitInfo.pSignalSemaphores = signalSemaphores;
-
-   if (vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[imageIndex]) != VK_SUCCESS) {
-      throw runtime_error("failed to submit draw command buffer!");
-   }
-
-   VkPresentInfoKHR presentInfo = {};
-   presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
-   presentInfo.waitSemaphoreCount = 1;
-   presentInfo.pWaitSemaphores = signalSemaphores;
-   presentInfo.swapchainCount = 1;
-   presentInfo.pSwapchains = &swapChain;
-   presentInfo.pImageIndices = &imageIndex;
-   presentInfo.pResults = nullptr;
-
-   result = vkQueuePresentKHR(presentQueue, &presentInfo);
-
-   if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || framebufferResized) {
-      framebufferResized = false;
-      recreateSwapChain();
-   } else if (result != VK_SUCCESS) {
-      throw runtime_error("failed to present swap chain image!");
-   }
-
-   currentFrame = (currentFrame + 1) % swapChainImageCount;
-}
-
 void VulkanGame::cleanup() {
    if (vkDeviceWaitIdle(device) != VK_SUCCESS) {
@@ -1806,4 +1745,67 @@
       }
    }
+}
+
+void VulkanGame::renderFrame() {
+   VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(),
+      imageAcquiredSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);
+
+   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
+      recreateSwapChain();
+      return;
+   } else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
+      throw runtime_error("failed to acquire swap chain image!");
+   }
+
+   if (vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()) != VK_SUCCESS) {
+      throw runtime_error("failed waiting for fence!");
+   }
+   if (vkResetFences(device, 1, &inFlightFences[imageIndex]) != VK_SUCCESS) {
+      throw runtime_error("failed to reset fence!");
+   }
+
+   updateScene();
+
+   VkSemaphore waitSemaphores[] = { imageAcquiredSemaphores[currentFrame] };
+   VkPipelineStageFlags waitStages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
+   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
+
+   VkSubmitInfo submitInfo = {};
+   submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+   submitInfo.waitSemaphoreCount = 1;
+   submitInfo.pWaitSemaphores = waitSemaphores;
+   submitInfo.pWaitDstStageMask = waitStages;
+   submitInfo.commandBufferCount = 1;
+   submitInfo.pCommandBuffers = &commandBuffers[imageIndex];
+   submitInfo.signalSemaphoreCount = 1;
+   submitInfo.pSignalSemaphores = signalSemaphores;
+
+   if (vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[imageIndex]) != VK_SUCCESS) {
+      throw runtime_error("failed to submit draw command buffer!");
+   }
+}
+
+void VulkanGame::presentFrame() {
+   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
+
+   VkPresentInfoKHR presentInfo = {};
+   presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
+   presentInfo.waitSemaphoreCount = 1;
+   presentInfo.pWaitSemaphores = signalSemaphores;
+   presentInfo.swapchainCount = 1;
+   presentInfo.pSwapchains = &swapChain;
+   presentInfo.pImageIndices = &imageIndex;
+   presentInfo.pResults = nullptr;
+
+   VkResult result = vkQueuePresentKHR(presentQueue, &presentInfo);
+
+   if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || framebufferResized) {
+      framebufferResized = false;
+      recreateSwapChain();
+   } else if (result != VK_SUCCESS) {
+      throw runtime_error("failed to present swap chain image!");
+   }
+
+   currentFrame = (currentFrame + 1) % swapChainImageCount;
 }
 
Index: vulkan-game.hpp
===================================================================
--- vulkan-game.hpp	(revision 9c0a614cccc4e71b75dbd749218b1adb7fa608b8)
+++ vulkan-game.hpp	(revision 4e2c709a2b53e4003dcc6c516f8d70b616fb8ff1)
@@ -386,5 +386,4 @@
       void mainLoop();
       void updateScene();
-      void renderScene();
       void cleanup();
 
@@ -452,4 +451,7 @@
             vector<VkDescriptorBufferInfo>& bufferInfoList);
 
+      void renderFrame();
+      void presentFrame();
+
       void recreateSwapChain();
 
