mirror of https://github.com/snes9xgit/snes9x.git
Gtk: Add UI option to configure size, indicators.
This commit is contained in:
parent
909d899512
commit
945cd27841
|
@ -67,7 +67,7 @@ static void ImGui_DrawPressedKeys(int spacing)
|
|||
draw_list->AddRectFilled(ImVec2(x, y),
|
||||
ImVec2(x + box_width, y + box_height),
|
||||
settings.box_color,
|
||||
3.0f);
|
||||
spacing / 2);
|
||||
|
||||
draw_list->AddText(ImVec2(x + spacing, y + spacing), settings.text_color, string);
|
||||
|
||||
|
@ -85,7 +85,7 @@ static void ImGui_DrawPressedKeys(int spacing)
|
|||
draw_list->AddRectFilled(ImVec2(x, y),
|
||||
ImVec2(x + box_width, y + box_height),
|
||||
settings.box_color,
|
||||
spacing / 3);
|
||||
spacing / 2);
|
||||
x += spacing;
|
||||
y += spacing;
|
||||
|
||||
|
@ -132,12 +132,15 @@ static void ImGui_DrawTextOverlay(const char *text,
|
|||
draw_list->AddRectFilled(ImVec2(x, y),
|
||||
ImVec2(x + box_size.x, y + box_size.y),
|
||||
settings.box_color,
|
||||
settings.spacing / 3);
|
||||
settings.spacing / 2);
|
||||
draw_list->AddText(ImVec2(x + padding, y + padding), settings.text_color, text);
|
||||
}
|
||||
|
||||
bool S9xImGuiDraw(int width, int height)
|
||||
{
|
||||
if (Memory.ROMFilename.empty())
|
||||
return false;
|
||||
|
||||
if (!ImGui::GetCurrentContext())
|
||||
return false;
|
||||
|
||||
|
@ -147,15 +150,6 @@ bool S9xImGuiDraw(int width, int height)
|
|||
ImGui::GetIO().DisplayFramebufferScale.y = 1.0;
|
||||
ImGui::NewFrame();
|
||||
|
||||
if (!GFX.InfoString.empty())
|
||||
ImGui_DrawTextOverlay(GFX.InfoString.c_str(),
|
||||
settings.spacing,
|
||||
height - settings.spacing,
|
||||
settings.spacing,
|
||||
ImGui::DrawTextAlignment::BEGIN,
|
||||
ImGui::DrawTextAlignment::END,
|
||||
width - settings.spacing * 4);
|
||||
|
||||
if (Settings.DisplayTime)
|
||||
{
|
||||
char string[256];
|
||||
|
@ -206,20 +200,32 @@ bool S9xImGuiDraw(int width, int height)
|
|||
ImGui_DrawPressedKeys(settings.spacing / 2);
|
||||
}
|
||||
|
||||
if (Settings.Paused || Settings.ForcedPause)
|
||||
if (Settings.DisplayIndicators)
|
||||
{
|
||||
ImGui_DrawTextOverlay("❚❚",
|
||||
settings.spacing,
|
||||
settings.spacing,
|
||||
settings.spacing);
|
||||
if (Settings.Paused || Settings.ForcedPause)
|
||||
{
|
||||
ImGui_DrawTextOverlay("❚❚",
|
||||
settings.spacing,
|
||||
settings.spacing,
|
||||
settings.spacing);
|
||||
}
|
||||
else if (Settings.TurboMode)
|
||||
{
|
||||
ImGui_DrawTextOverlay("▶▶",
|
||||
settings.spacing,
|
||||
settings.spacing,
|
||||
settings.spacing);
|
||||
}
|
||||
}
|
||||
else if (Settings.TurboMode)
|
||||
{
|
||||
ImGui_DrawTextOverlay("▶▶",
|
||||
|
||||
if (!GFX.InfoString.empty())
|
||||
ImGui_DrawTextOverlay(GFX.InfoString.c_str(),
|
||||
settings.spacing,
|
||||
height - settings.spacing,
|
||||
settings.spacing,
|
||||
settings.spacing);
|
||||
}
|
||||
ImGui::DrawTextAlignment::BEGIN,
|
||||
ImGui::DrawTextAlignment::END,
|
||||
width - settings.spacing * 4);
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ int Snes9xConfig::load_defaults()
|
|||
allow_xv = false;
|
||||
allow_xrandr = false;
|
||||
auto_vrr = false;
|
||||
osd_size = 24;
|
||||
force_inverted_byte_order = false;
|
||||
hires_effect = HIRES_NORMAL;
|
||||
pause_emulation_on_switch = false;
|
||||
|
@ -165,6 +166,7 @@ int Snes9xConfig::load_defaults()
|
|||
Settings.Transparency = true;
|
||||
Settings.DisplayTime = false;
|
||||
Settings.DisplayFrameRate = false;
|
||||
Settings.DisplayIndicators = false;
|
||||
Settings.SixteenBitSound = true;
|
||||
Settings.Stereo = true;
|
||||
Settings.ReverseStereo = false;
|
||||
|
@ -236,6 +238,7 @@ int Snes9xConfig::save_config_file()
|
|||
outstring("HardwareAcceleration", display_driver, "none, opengl, xv, vulkan");
|
||||
outint("SplashBackground", splash_image, "0: Black, 1: Color bars, 2: Pattern, 3: Blue, 4: Default");
|
||||
outbool("AutoVRR", auto_vrr, "Automatically use the best settings for variable sync in fullscreen mode");
|
||||
outint("OSDSize", osd_size, "Size of on-screen display elements. Default: 24pt");
|
||||
|
||||
section = "NTSC";
|
||||
outstring("Hue", std::to_string(ntsc_setup.hue));
|
||||
|
@ -316,6 +319,7 @@ int Snes9xConfig::save_config_file()
|
|||
outbool("DisplayTime", Settings.DisplayTime);
|
||||
outbool("DisplayFrameRate", Settings.DisplayFrameRate);
|
||||
outbool("DisplayPressedKeys", Settings.DisplayPressedKeys);
|
||||
outbool("DisplayIndicators", Settings.DisplayIndicators);
|
||||
outint("SpeedControlMethod", Settings.SkipFrames, "0: Time the frames to 50 or 60Hz, 1: Same, but skip frames if too slow, 2: Synchronize to the sound buffer, 3: Unlimited, except potentially by vsync");
|
||||
outint("SaveSRAMEveryNSeconds", Settings.AutoSaveDelay);
|
||||
outbool("BlockInvalidVRAMAccess", Settings.BlockInvalidVRAMAccessMaster);
|
||||
|
@ -460,6 +464,7 @@ int Snes9xConfig::load_config_file()
|
|||
inbool("BilinearFilter", Settings.BilinearFilter);
|
||||
inint("SplashBackground", splash_image);
|
||||
inbool("AutoVRR", auto_vrr);
|
||||
inint("OSDSize", osd_size);
|
||||
|
||||
section = "NTSC";
|
||||
indouble("Hue", ntsc_setup.hue);
|
||||
|
@ -541,6 +546,7 @@ int Snes9xConfig::load_config_file()
|
|||
inint("SaveSRAMEveryNSeconds", Settings.AutoSaveDelay);
|
||||
inbool("BlockInvalidVRAMAccess", Settings.BlockInvalidVRAMAccessMaster);
|
||||
inbool("AllowDPadContradictions", Settings.UpAndDown);
|
||||
inbool("DisplayIndicators", Settings.DisplayIndicators);
|
||||
|
||||
section = "Hacks";
|
||||
inint("SuperFXClockMultiplier", Settings.SuperFXClockMultiplier);
|
||||
|
|
|
@ -72,6 +72,7 @@ class Snes9xConfig
|
|||
bool force_inverted_byte_order;
|
||||
int splash_image;
|
||||
bool auto_vrr;
|
||||
int osd_size;
|
||||
|
||||
snes_ntsc_setup_t ntsc_setup;
|
||||
int ntsc_format;
|
||||
|
|
|
@ -407,7 +407,10 @@ int S9xOpenGLDisplayDriver::init()
|
|||
|
||||
if (version >= 33)
|
||||
{
|
||||
S9xImGuiInit();
|
||||
auto defaults = S9xImGuiGetDefaults();
|
||||
defaults.font_size = gui_config->osd_size;
|
||||
defaults.spacing = defaults.font_size / 2.4;
|
||||
S9xImGuiInit(&defaults);
|
||||
ImGui_ImplOpenGL3_Init();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,10 @@ S9xVulkanDisplayDriver::~S9xVulkanDisplayDriver()
|
|||
|
||||
bool S9xVulkanDisplayDriver::init_imgui()
|
||||
{
|
||||
S9xImGuiInit();
|
||||
auto defaults = S9xImGuiGetDefaults();
|
||||
defaults.font_size = gui_config->osd_size;
|
||||
defaults.spacing = defaults.font_size / 2.4;
|
||||
S9xImGuiInit(&defaults);
|
||||
|
||||
ImGui_ImplVulkan_LoadFunctions([](const char *function, void *instance) {
|
||||
return VULKAN_HPP_DEFAULT_DISPATCHER.vkGetInstanceProcAddr(*((VkInstance *)instance), function);
|
||||
|
|
|
@ -394,6 +394,8 @@ void Snes9xPreferences::move_settings_to_dialog()
|
|||
set_check("show_time", Settings.DisplayTime);
|
||||
set_check("show_frame_rate", Settings.DisplayFrameRate);
|
||||
set_check("show_pressed_keys", Settings.DisplayPressedKeys);
|
||||
set_check("show_indicators", Settings.DisplayIndicators);
|
||||
set_spin("osd_size", config->osd_size);
|
||||
set_check("change_display_resolution", config->change_display_resolution);
|
||||
set_check("scale_to_fit", config->scale_to_fit);
|
||||
set_check("overscan", config->overscan);
|
||||
|
@ -554,6 +556,10 @@ void Snes9xPreferences::get_settings_from_dialog()
|
|||
if (config->force_inverted_byte_order != get_check("force_inverted_byte_order"))
|
||||
gfx_needs_restart = true;
|
||||
|
||||
if (config->osd_size != get_spin("osd_size"))
|
||||
gfx_needs_restart = true;
|
||||
|
||||
|
||||
config->enable_icons = get_check("force_enable_icons");
|
||||
auto settings = Gtk::Settings::get_default();
|
||||
settings->set_property("gtk-menu-images", gui_config->enable_icons);
|
||||
|
@ -563,6 +569,8 @@ void Snes9xPreferences::get_settings_from_dialog()
|
|||
Settings.DisplayTime = get_check("show_time");
|
||||
Settings.DisplayFrameRate = get_check("show_frame_rate");
|
||||
Settings.DisplayPressedKeys = get_check("show_pressed_keys");
|
||||
Settings.DisplayIndicators = get_check("show_indicators");
|
||||
config->osd_size = get_spin("osd_size");
|
||||
config->scale_to_fit = get_check("scale_to_fit");
|
||||
config->overscan = get_check("overscan");
|
||||
config->maintain_aspect_ratio = get_check("maintain_aspect_ratio");
|
||||
|
|
|
@ -209,6 +209,13 @@
|
|||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">1</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="osd_size_adjustment">
|
||||
<property name="lower">12</property>
|
||||
<property name="upper">128</property>
|
||||
<property name="value">24</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">1</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment4">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">100</property>
|
||||
|
@ -2866,6 +2873,21 @@
|
|||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_indicators">
|
||||
<property name="label" translatable="yes">Show fast-forward and pause indicators</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="overscan">
|
||||
<property name="label" translatable="yes">Use overscanned height</property>
|
||||
|
@ -2879,9 +2901,56 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">4</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
|
||||
<child>
|
||||
<object class="GtkHBox" id="osd_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel" id="osdlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">On-screen display size:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="osd_size">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Connect to specified TCP port on remote computer</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">osd_size_adjustment</property>
|
||||
<property name="snap_to_ticks">True</property>
|
||||
<property name="width_chars">6</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
|
||||
<child>
|
||||
<object class="GtkHBox" id="resolution_box">
|
||||
<property name="visible">True</property>
|
||||
|
@ -2925,9 +2994,11 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">5</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
Loading…
Reference in New Issue