Skip to content

Commit

Permalink
Update ImGui to 1.90.1
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Jan 20, 2024
1 parent d12096e commit 0d2c0bb
Show file tree
Hide file tree
Showing 26 changed files with 30,610 additions and 12,390 deletions.
3 changes: 2 additions & 1 deletion platforms/desktop-shared/Makefile.sources
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ SOURCES_CXX := \
$(DESKTOP_SRC_DIR)/application.cpp \
$(DESKTOP_SRC_DIR)/config.cpp \
$(DESKTOP_SRC_DIR)/renderer.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_impl_sdl.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_impl_sdl2.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_impl_opengl2.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_draw.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_widgets.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_tables.cpp \
$(AUDIO_SRC_DIR)/Sound_Queue.cpp \
$(SRC_DIR)/Audio.cpp \
$(SRC_DIR)/AY8910.cpp \
Expand Down
6 changes: 3 additions & 3 deletions platforms/desktop-shared/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <SDL.h>
#include "imgui/imgui.h"
#include "imgui/imgui_impl_sdl.h"
#include "imgui/imgui_impl_sdl2.h"
#include "emu.h"
#include "gui.h"
#include "gui_debug.h"
Expand Down Expand Up @@ -94,6 +94,7 @@ void application_destroy(void)
config_write();
config_destroy();
renderer_destroy();
ImGui_ImplSDL2_Shutdown();
gui_destroy();
emu_destroy();
sdl_destroy();
Expand Down Expand Up @@ -215,7 +216,6 @@ static void sdl_destroy(void)
{
SDL_GameControllerClose(application_gamepad[0]);
SDL_GameControllerClose(application_gamepad[1]);
ImGui_ImplSDL2_Shutdown();
SDL_GL_DeleteContext(gl_context);
SDL_DestroyWindow(sdl_window);
SDL_Quit();
Expand Down Expand Up @@ -750,7 +750,7 @@ static void run_emulator(void)
static void render(void)
{
renderer_begin_render();
ImGui_ImplSDL2_NewFrame(sdl_window);
ImGui_ImplSDL2_NewFrame();
gui_render();
renderer_render();
renderer_end_render();
Expand Down
2 changes: 1 addition & 1 deletion platforms/desktop-shared/emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void emu_get_info(char* info)
}
else
{
sprintf(info, "No data!");
sprintf(info, "There is no ROM loaded!");
}
}

Expand Down
8 changes: 5 additions & 3 deletions platforms/desktop-shared/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1281,12 +1281,12 @@ static void popup_modal_keyboard()
{
if (ImGui::BeginPopupModal("Keyboard Configuration", NULL, ImGuiWindowFlags_AlwaysAutoResize))
{
ImGui::Text("Press any key...\n\n");
ImGui::Text("Press any key to assign...\n\n");
ImGui::Separator();

for (int i = 0; i < IM_ARRAYSIZE(ImGui::GetIO().KeysDown); i++)
for ( int i = 0; i < ImGuiKey_NamedKey_END; ++i )
{
if (ImGui::IsKeyPressed(i))
if (ImGui::IsKeyDown((ImGuiKey)i))
{
SDL_Scancode key = (SDL_Scancode)i;

Expand Down Expand Up @@ -1579,6 +1579,7 @@ static void menu_ffwd(void)

static void show_info(void)
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
ImGui::Begin("ROM Info", &config_emulator.show_info, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize);

static char info[512];
Expand All @@ -1592,6 +1593,7 @@ static void show_info(void)
ImGui::PopFont();

ImGui::End();
ImGui::PopStyleVar();
}

static void show_fps(void)
Expand Down
24 changes: 18 additions & 6 deletions platforms/desktop-shared/gui_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ void gui_debug_go_back(void)

static void debug_window_memory(void)
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
ImGui::SetNextWindowPos(ImVec2(567, 249), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(324, 308), ImGuiCond_FirstUseEver);

Expand Down Expand Up @@ -272,10 +273,12 @@ static void debug_window_memory(void)
}

ImGui::End();
ImGui::PopStyleVar();
}

static void debug_window_disassembler(void)
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
ImGui::SetNextWindowPos(ImVec2(159, 31), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(401, 641), ImGuiCond_FirstUseEver);

Expand Down Expand Up @@ -502,7 +505,7 @@ static void debug_window_disassembler(void)

ImGui::PushFont(gui_default_font);

bool window_visible = ImGui::BeginChild("##dis", ImVec2(ImGui::GetWindowContentRegionWidth(), 0), true, 0);
bool window_visible = ImGui::BeginChild("##dis", ImVec2(ImGui::GetContentRegionAvail().x, 0), true, 0);

if (window_visible)
{
Expand Down Expand Up @@ -572,7 +575,8 @@ static void debug_window_disassembler(void)
ImGui::SetScrollY((float)goto_back);
}

ImGuiListClipper clipper(dis_size, ImGui::GetTextLineHeightWithSpacing());
ImGuiListClipper clipper;
clipper.Begin(dis_size, ImGui::GetTextLineHeightWithSpacing());

while (clipper.Step())
{
Expand Down Expand Up @@ -664,10 +668,13 @@ static void debug_window_disassembler(void)
ImGui::PopFont();

ImGui::End();

ImGui::PopStyleVar();
}

static void debug_window_processor(void)
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
ImGui::SetNextWindowPos(ImVec2(6, 31), ImGuiCond_FirstUseEver);

ImGui::Begin("Z80 Status", &config_debug.show_processor, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize);
Expand Down Expand Up @@ -822,10 +829,12 @@ static void debug_window_processor(void)
ImGui::PopFont();

ImGui::End();
ImGui::PopStyleVar();
}

static void debug_window_vram_registers(void)
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
ImGui::SetNextWindowPos(ImVec2(567, 560), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(260, 329), ImGuiCond_FirstUseEver);

Expand All @@ -834,10 +843,12 @@ static void debug_window_vram_registers(void)
debug_window_vram_regs();

ImGui::End();
ImGui::PopStyleVar();
}

static void debug_window_vram(void)
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
ImGui::SetNextWindowPos(ImVec2(896, 31), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(668, 624), ImGuiCond_FirstUseEver);

Expand Down Expand Up @@ -884,6 +895,7 @@ static void debug_window_vram(void)
}

ImGui::End();
ImGui::PopStyleVar();
}

static void debug_window_vram_background(void)
Expand Down Expand Up @@ -947,7 +959,7 @@ static void debug_window_vram_background(void)
tile_x = (int)(mouse_x / spacing_h);
tile_y = (int)(mouse_y / spacing_v);

draw_list->AddRect(ImVec2(p.x + (tile_x * spacing_h), p.y + (tile_y * spacing_v)), ImVec2(p.x + ((tile_x + 1) * spacing_h), p.y + ((tile_y + 1) * spacing_v)), ImColor(cyan), 2.0f, 15, 2.0f);
draw_list->AddRect(ImVec2(p.x + (tile_x * spacing_h), p.y + (tile_y * spacing_v)), ImVec2(p.x + ((tile_x + 1) * spacing_h), p.y + ((tile_y + 1) * spacing_v)), ImColor(cyan), 2.0f, ImDrawFlags_RoundCornersAll, 2.0f);

ImGui::NextColumn();

Expand Down Expand Up @@ -1044,7 +1056,7 @@ static void debug_window_vram_tiles(void)
tile_x = (int)(mouse_x / spacing);
tile_y = (int)(mouse_y / spacing);

draw_list->AddRect(ImVec2(p.x + (tile_x * spacing), p.y + (tile_y * spacing)), ImVec2(p.x + ((tile_x + 1) * spacing), p.y + ((tile_y + 1) * spacing)), ImColor(cyan), 2.0f, 15, 2.0f);
draw_list->AddRect(ImVec2(p.x + (tile_x * spacing), p.y + (tile_y * spacing)), ImVec2(p.x + ((tile_x + 1) * spacing), p.y + ((tile_y + 1) * spacing)), ImColor(cyan), 2.0f, ImDrawFlags_RoundCornersAll, 2.0f);

ImGui::NextColumn();

Expand Down Expand Up @@ -1115,7 +1127,7 @@ static void debug_window_vram_sprites(void)
if ((mouse_x >= 0.0f) && (mouse_x < width) && (mouse_y >= 0.0f) && (mouse_y < height))
{
ImDrawList* draw_list = ImGui::GetWindowDrawList();
draw_list->AddRect(ImVec2(p[s].x, p[s].y), ImVec2(p[s].x + width, p[s].y + height), ImColor(cyan), 2.0f, 15, 3.0f);
draw_list->AddRect(ImVec2(p[s].x, p[s].y), ImVec2(p[s].x + width, p[s].y + height), ImColor(cyan), 2.0f, ImDrawFlags_RoundCornersAll, 3.0f);
}

if (s % 4 < 3)
Expand Down Expand Up @@ -1194,7 +1206,7 @@ static void debug_window_vram_sprites(void)
recty_max = fminf(fmaxf(recty_max, p_screen.y), p_screen.y + (runtime.screen_height * screen_scale));

ImDrawList* draw_list = ImGui::GetWindowDrawList();
draw_list->AddRect(ImVec2(rectx_min, recty_min), ImVec2(rectx_max, recty_max), ImColor(cyan), 2.0f, 15, 2.0f);
draw_list->AddRect(ImVec2(rectx_min, recty_min), ImVec2(rectx_max, recty_max), ImColor(cyan), 2.0f, ImDrawFlags_RoundCornersAll, 2.0f);

ImGui::TextColored(yellow, "DETAILS:");
ImGui::TextColored(cyan, " X:"); ImGui::SameLine();
Expand Down
Loading

0 comments on commit 0d2c0bb

Please sign in to comment.