Skip to content

Commit

Permalink
UI shader file names
Browse files Browse the repository at this point in the history
Minor window handling code cleanup
  • Loading branch information
SaschaWillems committed May 23, 2024
1 parent be3d927 commit 52511a7
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions base/vulkanexamplebase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ void VulkanExampleBase::prepare()
ui.device = vulkanDevice;
ui.queue = queue;
ui.shaders = {
loadShader(getShadersPath() + "base/ui.vert.spv", VK_SHADER_STAGE_VERTEX_BIT),
loadShader(getShadersPath() + "base/ui.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT),
loadShader(getShadersPath() + "base/uioverlay.vert.spv", VK_SHADER_STAGE_VERTEX_BIT),
loadShader(getShadersPath() + "base/uioverlay.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT),
};
ui.prepareResources();
ui.preparePipeline(pipelineCache, renderPass, swapChain.colorFormat, depthFormat);
Expand Down Expand Up @@ -1226,11 +1226,12 @@ HWND VulkanExampleBase::setupWindow(HINSTANCE hinstance, WNDPROC wndproc)
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
}

RECT windowRect;
windowRect.left = 0L;
windowRect.top = 0L;
windowRect.right = settings.fullscreen ? (long)screenWidth : (long)width;
windowRect.bottom = settings.fullscreen ? (long)screenHeight : (long)height;
RECT windowRect = {
0L,
0L,
settings.fullscreen ? (long)screenWidth : (long)width,
settings.fullscreen ? (long)screenHeight : (long)height
};

AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);

Expand All @@ -1248,6 +1249,13 @@ HWND VulkanExampleBase::setupWindow(HINSTANCE hinstance, WNDPROC wndproc)
hinstance,
NULL);

if (!window)
{
std::cerr << "Could not create window!\n";
fflush(stdout);
return nullptr;
}

if (!settings.fullscreen)
{
// Center on screen
Expand All @@ -1256,13 +1264,6 @@ HWND VulkanExampleBase::setupWindow(HINSTANCE hinstance, WNDPROC wndproc)
SetWindowPos(window, 0, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}

if (!window)
{
printf("Could not create window!\n");
fflush(stdout);
return nullptr;
}

ShowWindow(window, SW_SHOW);
SetForegroundWindow(window);
SetFocus(window);
Expand Down

0 comments on commit 52511a7

Please sign in to comment.