Skip to content

Commit

Permalink
minor performance fix
Browse files Browse the repository at this point in the history
  • Loading branch information
v-maxson committed Jul 13, 2022
1 parent 6179482 commit 64a0ea7
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <imgui_impl_sdl.h>
#include <imgui_impl_sdlrenderer.h>
#include <Windows.h>
#include <thread>


constexpr const char* WINDOW_TITLE = "Elden Ring Launcher";
Expand Down Expand Up @@ -168,6 +169,9 @@ void Gui::Render() noexcept {
} break;
}
}
else {
g_shouldLoop = false;
}
}

ImGui::Separator();
Expand All @@ -186,26 +190,29 @@ void Gui::Render() noexcept {
// An error occured.
if ((INT_PTR)result < 32) {
switch ((INT_PTR)result) {
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND: {
SDL_ShowSimpleMessageBox(
SDL_MESSAGEBOX_ERROR,
"Elden Ring Launcher Error",
"Could not find eldenring.exe",
g_window
);
} break;

default: {
SDL_ShowSimpleMessageBox(
SDL_MESSAGEBOX_ERROR,
"Elden Ring Launcher Error",
"An error occured while trying to launch Elden Ring in offline mode.\n\nThis may be due to missing permissions.",
g_window
);
} break;
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND: {
SDL_ShowSimpleMessageBox(
SDL_MESSAGEBOX_ERROR,
"Elden Ring Launcher Error",
"Could not find eldenring.exe",
g_window
);
} break;

default: {
SDL_ShowSimpleMessageBox(
SDL_MESSAGEBOX_ERROR,
"Elden Ring Launcher Error",
"An error occured while trying to launch Elden Ring in offline mode.\n\nThis may be due to missing permissions.",
g_window
);
} break;
}
}
else {
g_shouldLoop = false;
}
}

ImGui::End();
Expand All @@ -232,6 +239,8 @@ void Gui::Run() {
Gui::BeginRender();
Gui::Render();
Gui::EndRender();

std::this_thread::sleep_for(std::chrono::milliseconds(50));
}

Gui::DestroyImGui();
Expand Down

0 comments on commit 64a0ea7

Please sign in to comment.