Skip to content

Commit

Permalink
Move video debug config entries into their own table
Browse files Browse the repository at this point in the history
  • Loading branch information
antangelo committed Oct 16, 2023
1 parent 60768ba commit 65bcc0e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
37 changes: 19 additions & 18 deletions config_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,25 @@ display:
type: bool
default: true
debug:
video_transparency:
type: bool
default: false
video_x_pos:
type: number
default: 100.0
video_y_pos:
type: number
default: 100.0
video_x_winsize:
type: number
default: 600.0
video_y_winsize:
type: number
default: 150.0
video_advancedtree_state:
type: bool
default: false
video:
transparency:
type: bool
default: false
x_pos:
type: number
default: 100.0
y_pos:
type: number
default: 100.0
x_winsize:
type: number
default: 600.0
y_winsize:
type: number
default: 150.0
advanced_tree_state:
type: bool
default: false

audio:
use_dsp: bool
Expand Down
26 changes: 13 additions & 13 deletions ui/xui/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,18 @@ void DebugVideoWindow::Draw()
return;

if (!m_position_restored) {
ImGui::SetNextWindowPos(ImVec2(g_config.display.debug.video_x_pos, g_config.display.debug.video_y_pos),
ImGuiCond_Once, ImVec2(0, 0));
m_transparent = g_config.display.debug.video_transparency;
ImGui::SetNextWindowPos(ImVec2(g_config.display.debug.video.x_pos, g_config.display.debug.video.y_pos),
ImGuiCond_Once, ImVec2(0, 0) );
m_transparent = g_config.display.debug.video.transparency;
m_position_restored = true;
}

float alpha = m_transparent ? 0.2 : 1.0;
PushWindowTransparencySettings(m_transparent, 0.2);

if (!m_resize_init_complete || (g_viewport_mgr.m_scale != m_prev_scale)) {
ImGui::SetNextWindowSize(ImVec2(g_config.display.debug.video_x_winsize*g_viewport_mgr.m_scale,
g_config.display.debug.video_y_winsize*g_viewport_mgr.m_scale));
ImGui::SetNextWindowSize(ImVec2(g_config.display.debug.video.x_winsize*g_viewport_mgr.m_scale,
g_config.display.debug.video.y_winsize*g_viewport_mgr.m_scale));
m_resize_init_complete = true;
}
m_prev_scale = g_viewport_mgr.m_scale;
Expand Down Expand Up @@ -304,10 +304,10 @@ void DebugVideoWindow::Draw()
}
ImPlot::PopStyleColor();

ImGui::SetNextItemOpen(g_config.display.debug.video_advancedtree_state, ImGuiCond_Once);
g_config.display.debug.video_advancedtree_state = ImGui::TreeNode("Advanced");
ImGui::SetNextItemOpen(g_config.display.debug.video.advanced_tree_state, ImGuiCond_Once);
g_config.display.debug.video.advanced_tree_state = ImGui::TreeNode("Advanced");

if (g_config.display.debug.video_advancedtree_state) {
if (g_config.display.debug.video.advanced_tree_state) {
ImGui::SetNextWindowBgAlpha(alpha);
if (ImPlot::BeginPlot("##ScrollingDraws", ImVec2(-1,-1))) {
ImPlot::SetupAxes(NULL, NULL, ImPlotAxisFlags_None, ImPlotAxisFlags_AutoFit);
Expand Down Expand Up @@ -348,13 +348,13 @@ void DebugVideoWindow::Draw()
ImPlot::PopStyleVar(2);

ImVec2 debug_window_pos = ImGui::GetWindowPos();
g_config.display.debug.video_x_pos = debug_window_pos.x;
g_config.display.debug.video_y_pos = debug_window_pos.y;
g_config.display.debug.video.x_pos = debug_window_pos.x;
g_config.display.debug.video.y_pos = debug_window_pos.y;

ImVec2 debug_window_size = ImGui::GetWindowSize();
g_config.display.debug.video_x_winsize = debug_window_size.x / g_viewport_mgr.m_scale;
g_config.display.debug.video_y_winsize = debug_window_size.y / g_viewport_mgr.m_scale;
g_config.display.debug.video_transparency = m_transparent;
g_config.display.debug.video.x_winsize = debug_window_size.x / g_viewport_mgr.m_scale;
g_config.display.debug.video.y_winsize = debug_window_size.y / g_viewport_mgr.m_scale;
g_config.display.debug.video.transparency = m_transparent;
}
ImGui::End();
ImGui::PopStyleColor(5);
Expand Down

0 comments on commit 65bcc0e

Please sign in to comment.