Skip to content

Commit

Permalink
Debugger font size
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed May 7, 2020
1 parent c050276 commit b31142c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions platforms/desktop-shared/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void config_read(void)
config_debug.show_memory = read_bool("Debug", "Memory", true);
config_debug.show_processor = read_bool("Debug", "Processor", true);
config_debug.show_video = read_bool("Debug", "Video", false);
config_debug.font_size = read_int("Debug", "FontSize", 0);

config_emulator.ffwd_speed = read_int("Emulator", "FFWD", 1);
config_emulator.save_slot = read_int("Emulator", "SaveSlot", 0);
Expand Down Expand Up @@ -147,6 +148,7 @@ void config_write(void)
write_bool("Debug", "Memory", config_debug.show_memory);
write_bool("Debug", "Processor", config_debug.show_processor);
write_bool("Debug", "Video", config_debug.show_video);
write_int("Debug", "FontSize", config_debug.font_size);

write_int("Emulator", "FFWD", config_emulator.ffwd_speed);
write_int("Emulator", "SaveSlot", config_emulator.save_slot);
Expand Down
1 change: 1 addition & 0 deletions platforms/desktop-shared/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ struct config_Debug
bool show_iomap = false;
bool show_audio = false;
bool show_video = false;
int font_size = 0;
};

EXTERN mINI::INIFile* config_ini_file;
Expand Down
26 changes: 23 additions & 3 deletions platforms/desktop-shared/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static int* configured_button;
static ImVec4 custom_palette[4];
static std::list<std::string> cheat_list;
static bool shortcut_open_rom = false;

static ImFont* default_font[4];

static void main_menu(void);
static void main_window(void);
Expand Down Expand Up @@ -81,9 +81,14 @@ void gui_init(void)
gui_roboto_font = io.Fonts->AddFontFromMemoryCompressedTTF(RobotoMedium_compressed_data, RobotoMedium_compressed_size, 17.0f * application_display_scale, NULL, io.Fonts->GetGlyphRangesCyrillic());

ImFontConfig font_cfg;
font_cfg.SizePixels = 13.0f * application_display_scale;

gui_default_font = io.Fonts->AddFontDefault(&font_cfg);
for (int i = 0; i < 4; i++)
{
font_cfg.SizePixels = (13.0f + (i * 3)) * application_display_scale;
default_font[i] = io.Fonts->AddFontDefault(&font_cfg);
}

gui_default_font = default_font[config_debug.font_size];

update_palette();

Expand Down Expand Up @@ -598,6 +603,21 @@ static void main_menu(void)

ImGui::Separator();

if (ImGui::BeginMenu("Font Size"))
{
ImGui::PushItemWidth(110.0f);
if (ImGui::Combo("##font", &config_debug.font_size, "Very Small\0Small\0Medium\0Large\0\0"))
{
gui_default_font = default_font[config_debug.font_size];
}
ImGui::PopItemWidth();
ImGui::EndMenu();
}

ImGui::MenuItem("Show Game Boy Screen", "", &config_debug.show_gameboy, config_debug.font_size);

ImGui::Separator();

ImGui::MenuItem("Show Game Boy Screen", "", &config_debug.show_gameboy, config_debug.debug);

ImGui::MenuItem("Show Disassembler", "", &config_debug.show_disassembler, config_debug.debug);
Expand Down
2 changes: 0 additions & 2 deletions platforms/desktop-shared/gui_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,10 @@ static void debug_window_disassembler(void)
sprintf(brk_address, "%02X:%04X", selected_record->bank, selected_record->address);

ImGui::PushItemWidth(70);
ImGui::PushFont(gui_default_font);
if (ImGui::InputTextWithHint("##add_breakpoint", "XX:XXXX", brk_address, IM_ARRAYSIZE(brk_address), ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_EnterReturnsTrue))
{
add_breakpoint();
}
ImGui::PopFont();
ImGui::PopItemWidth();

if (ImGui::Button("Add", ImVec2(70, 0)))
Expand Down

0 comments on commit b31142c

Please sign in to comment.