diff --git a/external/cimgui b/external/cimgui index ccdae842..b6e02f41 160000 --- a/external/cimgui +++ b/external/cimgui @@ -1 +1 @@ -Subproject commit ccdae842e40f35ebf40167918175deb9af8c2a16 +Subproject commit b6e02f41318eef221a9313dfe1a8177c7d6148ab diff --git a/external/meson.build b/external/meson.build index a84da786..3130184a 100644 --- a/external/meson.build +++ b/external/meson.build @@ -13,6 +13,8 @@ cflags += [ '-DIMGUI_IMPL_API=extern "C" ', + '-DCIMGUI_USE_OPENGL3', + '-DCIMGUI_USE_SDL2', ] imgui_inc = include_directories( @@ -57,7 +59,7 @@ imgui = static_library( 'cimgui/imgui/imgui_tables.cpp', 'cimgui/imgui/imgui_widgets.cpp', 'cimgui/imgui/backends/imgui_impl_opengl3.cpp', - 'cimgui/imgui/backends/imgui_impl_sdl.cpp', + 'cimgui/imgui/backends/imgui_impl_sdl2.cpp', include_directories: imgui_inc, dependencies: imgui_dep, c_args: cflags, diff --git a/external/mjson b/external/mjson index 817eaa13..b766f343 160000 --- a/external/mjson +++ b/external/mjson @@ -1 +1 @@ -Subproject commit 817eaa13128f38112ff91c5f520e99a2c79fd23a +Subproject commit b766f343bf68b8ea89889055acbf8aef820e2b71 diff --git a/external/nfde b/external/nfde index 6efc8240..5786fabc 160000 --- a/external/nfde +++ b/external/nfde @@ -1 +1 @@ -Subproject commit 6efc824070c79afd42a3a9e08da8f867d0ca2a97 +Subproject commit 5786fabceeaee4d892f3c7a16b243796244cdddc diff --git a/external/stb b/external/stb index af1a5bc3..f4a71b13 160000 --- a/external/stb +++ b/external/stb @@ -1 +1 @@ -Subproject commit af1a5bc352164740c1cc1354942b1c6b72eacb8a +Subproject commit f4a71b13373436a2866c5d68f8f80ac6f0bc1ffe diff --git a/source/app/sdl/video.c b/source/app/sdl/video.c index 24ee17f7..24f60eee 100644 --- a/source/app/sdl/video.c +++ b/source/app/sdl/video.c @@ -421,7 +421,7 @@ app_sdl_video_render_frame( ) { /* Create the new frame */ ImGui_ImplOpenGL3_NewFrame(); - ImGui_ImplSDL2_NewFrame(app->sdl.window); + ImGui_ImplSDL2_NewFrame(); igNewFrame(); /* Render the ImGui stuff */ @@ -452,16 +452,5 @@ app_sdl_video_render_frame( glClear(GL_COLOR_BUFFER_BIT); ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData()); - if (app->ui.ioptr->ConfigFlags & ImGuiConfigFlags_ViewportsEnable) { - SDL_Window *backup_current_window; - SDL_GLContext backup_current_context; - - backup_current_window = SDL_GL_GetCurrentWindow(); - backup_current_context = SDL_GL_GetCurrentContext(); - igUpdatePlatformWindows(); - igRenderPlatformWindowsDefault(NULL,NULL); - SDL_GL_MakeCurrent(backup_current_window, backup_current_context); - } - SDL_GL_SwapWindow(app->sdl.window); } diff --git a/source/app/windows/game.c b/source/app/windows/game.c index 376a6c37..6f11ecfb 100644 --- a/source/app/windows/game.c +++ b/source/app/windows/game.c @@ -126,8 +126,8 @@ app_win_game( }; } - igPushStyleVarVec2(ImGuiStyleVar_WindowPadding, (ImVec2){.x = 0, .y = 0}); - igPushStyleVarFloat(ImGuiStyleVar_WindowBorderSize, 0); + igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, (ImVec2){.x = 0, .y = 0}); + igPushStyleVar_Float(ImGuiStyleVar_WindowBorderSize, 0); igSetNextWindowPos((ImVec2){.x = game_pos_x, .y = (float)app->ui.menubar_size.y + game_pos_y}, ImGuiCond_Always, (ImVec2){.x = 0, .y = 0}); igSetNextWindowSize((ImVec2){.x = game_size_x, .y = game_size_y}, ImGuiCond_Always); @@ -137,7 +137,6 @@ app_win_game( NULL, ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_AlwaysAutoResize - | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus diff --git a/source/app/windows/keybinds.c b/source/app/windows/keybinds.c index ebf0cd66..bda565fc 100644 --- a/source/app/windows/keybinds.c +++ b/source/app/windows/keybinds.c @@ -70,7 +70,7 @@ app_win_keybinds_editor( ) { if (app->ui.keybindings_editor.open) { app->ui.keybindings_editor.open = false; - igOpenPopup("Keybindings Editor", ImGuiPopupFlags_None); + igOpenPopup_Str("Keybindings Editor", ImGuiPopupFlags_None); } app->ui.keybindings_editor.visible = false; diff --git a/source/app/windows/menubar.c b/source/app/windows/menubar.c index 486f6fc7..a293ad8c 100644 --- a/source/app/windows/menubar.c +++ b/source/app/windows/menubar.c @@ -25,7 +25,7 @@ app_win_menubar_file( struct app *app ) { if (igBeginMenu("File", true)) { - if (igMenuItemBool("Open", NULL, false, true)) { + if (igMenuItem_Bool("Open", NULL, false, true)) { nfdresult_t result; nfdchar_t *path; @@ -48,7 +48,7 @@ app_win_menubar_file( uint32_t x; for (x = 0; x < array_length(app->file.recent_roms) && app->file.recent_roms[x]; ++x) { - if (igMenuItemBool(hs_basename(app->file.recent_roms[x]), NULL, false, true)) { + if (igMenuItem_Bool(hs_basename(app->file.recent_roms[x]), NULL, false, true)) { char *path; // app->file.recent_roms[] is modified by `app_emulator_configure()` so we need to copy @@ -65,7 +65,7 @@ app_win_menubar_file( igEndMenu(); } - if (igMenuItemBool("Open BIOS", NULL, false, true)) { + if (igMenuItem_Bool("Open BIOS", NULL, false, true)) { nfdresult_t result; nfdchar_t *path; @@ -85,7 +85,7 @@ app_win_menubar_file( igSeparator(); - if (igMenuItemBool("Keybindings", NULL, false, true)) { + if (igMenuItem_Bool("Keybindings", NULL, false, true)) { app->ui.keybindings_editor.open = true; } @@ -99,7 +99,7 @@ app_win_menubar_emulation( struct app *app ) { if (igBeginMenu("Emulation", true)) { - if (igMenuItemBool("Skip BIOS", NULL, app->emulation.skip_bios, true)) { + if (igMenuItem_Bool("Skip BIOS", NULL, app->emulation.skip_bios, true)) { app->emulation.skip_bios ^= 1; } @@ -118,7 +118,7 @@ app_win_menubar_emulation( char const *bind; bind = SDL_GetKeyName(app->binds.keyboard[BIND_EMULATOR_SPEED_MAX + x]); - if (igMenuItemBool(speed[x], bind ?: "", app->emulation.speed == x, true)) { + if (igMenuItem_Bool(speed[x], bind ?: "", app->emulation.speed == x, true)) { app->emulation.unbounded = false; app->emulation.speed = x; app_emulator_speed(app, app->emulation.speed); @@ -148,7 +148,7 @@ app_win_menubar_emulation( hs_assert(text); - if (igMenuItemBool(text, NULL, false, true)) { + if (igMenuItem_Bool(text, NULL, false, true)) { app_emulator_quicksave(app, i); } @@ -172,7 +172,7 @@ app_win_menubar_emulation( hs_assert(text); - if (igMenuItemBool(text, NULL, false, app->file.qsaves[i].exist && app->file.qsaves[i].mtime)) { + if (igMenuItem_Bool(text, NULL, false, app->file.qsaves[i].exist && app->file.qsaves[i].mtime)) { app_emulator_quickload(app, i); } @@ -187,14 +187,14 @@ app_win_menubar_emulation( if (igBeginMenu("Backup Storage", !app->emulation.is_started)) { uint32_t x; - if (igMenuItemBool("Auto-detect", NULL, app->emulation.backup_storage.autodetect, true)) { + if (igMenuItem_Bool("Auto-detect", NULL, app->emulation.backup_storage.autodetect, true)) { app->emulation.backup_storage.autodetect ^= 1; } igSeparator(); for (x = BACKUP_MIN; x < BACKUP_LEN; ++x) { - if (igMenuItemBool(backup_storage_names[x], NULL, !app->emulation.backup_storage.autodetect && app->emulation.backup_storage.type == x, true)) { + if (igMenuItem_Bool(backup_storage_names[x], NULL, !app->emulation.backup_storage.autodetect && app->emulation.backup_storage.type == x, true)) { app->emulation.backup_storage.type = x; app->emulation.backup_storage.autodetect = false; } @@ -209,10 +209,10 @@ app_win_menubar_emulation( igText("RTC"); igSeparator(); - if (igMenuItemBool("Auto-detect", NULL, app->emulation.rtc.autodetect, true)) { + if (igMenuItem_Bool("Auto-detect", NULL, app->emulation.rtc.autodetect, true)) { app->emulation.rtc.autodetect ^= 1; } - if (igMenuItemBool("Enable", NULL, app->emulation.rtc.enabled, !app->emulation.rtc.autodetect)) { + if (igMenuItem_Bool("Enable", NULL, app->emulation.rtc.enabled, !app->emulation.rtc.autodetect)) { app->emulation.rtc.enabled ^= 1; } igEndMenu(); @@ -220,7 +220,7 @@ app_win_menubar_emulation( igSeparator(); - if (igMenuItemBool("Pause", NULL, !app->emulation.is_running, app->emulation.is_started)) { + if (igMenuItem_Bool("Pause", NULL, !app->emulation.is_running, app->emulation.is_started)) { if (app->emulation.is_running) { app_emulator_pause(app); } else { @@ -228,11 +228,11 @@ app_win_menubar_emulation( } } - if (igMenuItemBool("Stop", NULL, false, app->emulation.is_started)) { + if (igMenuItem_Bool("Stop", NULL, false, app->emulation.is_started)) { app_emulator_stop(app); } - if (igMenuItemBool("Reset", NULL, false, app->emulation.is_started)) { + if (igMenuItem_Bool("Reset", NULL, false, app->emulation.is_started)) { app_emulator_reset(app); app_emulator_run(app); } @@ -268,7 +268,7 @@ app_win_menubar_video( height = max(0, height - app->ui.menubar_size.y); for (x = 1; x <= 5; ++x) { - if (igMenuItemBool( + if (igMenuItem_Bool( display_sizes[x - 1], NULL, width == GBA_SCREEN_WIDTH * x * app->ui.scale && height == GBA_SCREEN_HEIGHT * x * app->ui.scale, @@ -285,7 +285,7 @@ app_win_menubar_video( /* Aspect Ratio */ if (igBeginMenu("Aspect Ratio", true)) { - if (igMenuItemBool( + if (igMenuItem_Bool( "Auto resize", NULL, app->video.aspect_ratio == ASPECT_RATIO_RESIZE, @@ -297,7 +297,7 @@ app_win_menubar_video( app->ui.win.resize_ratio = min(app->ui.game.width / ((float)GBA_SCREEN_WIDTH * app->ui.scale), app->ui.game.height / ((float)GBA_SCREEN_HEIGHT * app->ui.scale)); } - if (igMenuItemBool( + if (igMenuItem_Bool( "Black borders", NULL, app->video.aspect_ratio == ASPECT_RATIO_BORDERS, @@ -306,7 +306,7 @@ app_win_menubar_video( app->video.aspect_ratio = ASPECT_RATIO_BORDERS; } - if (igMenuItemBool( + if (igMenuItem_Bool( "Stretch", NULL, app->video.aspect_ratio == ASPECT_RATIO_STRETCH, @@ -322,12 +322,12 @@ app_win_menubar_video( /* Texture Filter */ if (igBeginMenu("Texture Filter", true)) { - if (igMenuItemBool("Nearest", NULL, app->gfx.texture_filter == TEXTURE_FILTER_NEAREST, true)) { + if (igMenuItem_Bool("Nearest", NULL, app->gfx.texture_filter == TEXTURE_FILTER_NEAREST, true)) { app->gfx.texture_filter = TEXTURE_FILTER_NEAREST; app_sdl_video_rebuild_pipeline(app); } - if (igMenuItemBool("Linear", NULL, app->gfx.texture_filter == TEXTURE_FILTER_LINEAR, true)) { + if (igMenuItem_Bool("Linear", NULL, app->gfx.texture_filter == TEXTURE_FILTER_LINEAR, true)) { app->gfx.texture_filter = TEXTURE_FILTER_LINEAR; app_sdl_video_rebuild_pipeline(app); } @@ -336,19 +336,19 @@ app_win_menubar_video( } /* Color Correction */ - if (igMenuItemBool("Color correction", NULL, app->video.color_correction, true)) { + if (igMenuItem_Bool("Color correction", NULL, app->video.color_correction, true)) { app->video.color_correction ^= 1; app_sdl_video_rebuild_pipeline(app); } /* LCD Effect */ - if (igMenuItemBool("LCD Grid Effect", NULL, app->video.lcd_grid, true)) { + if (igMenuItem_Bool("LCD Grid Effect", NULL, app->video.lcd_grid, true)) { app->video.lcd_grid ^= 1; app_sdl_video_rebuild_pipeline(app); } /* VSync */ - if (igMenuItemBool("VSync", NULL, app->video.vsync, true)) { + if (igMenuItem_Bool("VSync", NULL, app->video.vsync, true)) { app->video.vsync ^= 1; SDL_GL_SetSwapInterval(app->video.vsync); } @@ -357,7 +357,7 @@ app_win_menubar_video( /* Take a screenshot */ bind = SDL_GetKeyName(app->binds.keyboard[BIND_EMULATOR_SCREENSHOT]); - if (igMenuItemBool("Screenshot", bind ? bind : "", false, app->emulation.is_started)) { + if (igMenuItem_Bool("Screenshot", bind ? bind : "", false, app->emulation.is_started)) { app_emulator_screenshot(app); } @@ -374,7 +374,7 @@ app_win_menubar_audio( float percent; /* VSync */ - if (igMenuItemBool("Mute", NULL, app->audio.mute, true)) { + if (igMenuItem_Bool("Mute", NULL, app->audio.mute, true)) { app->audio.mute ^= 1; } @@ -387,7 +387,7 @@ app_win_menubar_audio( igSetNextItemWidth(100.f * app->ui.scale); percent = app->audio.level * 100.f; - igSliderFloat("", &percent, 0.0f, 100.0f, "%.0f%%", ImGuiSliderFlags_None); + igSliderFloat("##slider_sound_level", &percent, 0.0f, 100.0f, "%.0f%%", ImGuiSliderFlags_None); app->audio.level = max(0.0f, min(percent / 100.f, 1.f)); igSpacing(); @@ -408,21 +408,21 @@ app_win_menubar_help( if (igBeginMenu("Help", true)) { /* Report Issue */ - if (igMenuItemBool("Report Issue", NULL, false, true)) { + if (igMenuItem_Bool("Report Issue", NULL, false, true)) { hs_open_url("https://github.com/Arignir/Hades/issues/new"); } igSeparator(); /* About */ - if (igMenuItemBool("About", NULL, false, true)) { + if (igMenuItem_Bool("About", NULL, false, true)) { open_about = true; } igEndMenu(); } if (open_about) { - igOpenPopup("About", ImGuiPopupFlags_None); + igOpenPopup_Str("About", ImGuiPopupFlags_None); } // Always center the modal