Fix main.cpp rendering loop and update CMakeLists.txt

This commit is contained in:
ramenrrami 2025-09-21 22:12:01 +02:00
parent 0af6018a3f
commit 7e3a0d97d5
2 changed files with 15 additions and 12 deletions

View file

@ -80,12 +80,18 @@ endforeach()
# Optimizations
set_property(TARGET Pound PROPERTY CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
if (WIN32)
target_compile_options(Pound PRIVATE $<$<CONFIG:Release>:/Oi>)
target_compile_options(Pound PRIVATE $<$<CONFIG:Release>:/Ot>)
endif()
# --------------------------------
# ---- Optimizations / Flags -----
# --------------------------------
# (optional) LTO/IPO in Release, nur wenn unterstützt
set_property(TARGET Pound PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
# MSVC-spezifische Flags NUR bei MSVC setzen (nicht bei MinGW/GCC)
target_compile_options(Pound PRIVATE
$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:Release>>:/Oi /Ot>
)
target_link_libraries(Pound PRIVATE
common

View file

@ -18,7 +18,7 @@
int main()
{
#if 0
#if 1
gui::window_t window = {.data = nullptr, .gl_context = nullptr};
(void)gui::window_init(&window, "Pound Emulator", 640, 480);
@ -103,11 +103,8 @@ int main()
::glClear(GL_COLOR_BUFFER_BIT);
::ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
if (bool sdl_ret_code = ::SDL_GL_SwapWindow(gui.window.data); false == sdl_ret_code)
{
LOG_ERROR("Failed to update window with OpenGL rendering: {}", SDL_GetError());
is_running = false;
}
::SDL_GL_SwapWindow(gui.window.data);
// Small delay to prevent excessive CPU usage
std::this_thread::sleep_for(std::chrono::milliseconds(5));