mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-15 03:40:56 +01:00
refactor debugging windows
This commit is contained in:
parent
bf1154945b
commit
c9c5155333
1 changed files with 29 additions and 22 deletions
|
@ -22,34 +22,41 @@ class GBAController < Controller
|
||||||
# Debug
|
# Debug
|
||||||
|
|
||||||
def render_debug_items : Nil
|
def render_debug_items : Nil
|
||||||
ImGui.menu_item("Debug", "", pointerof(@debug_window))
|
ImGui.menu_item("Video", "", pointerof(@debug_window))
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_windows : Nil
|
def render_windows : Nil
|
||||||
if @debug_window
|
if @debug_window
|
||||||
ImGui.begin("Debug", pointerof(@debug_window))
|
ImGui.begin("Video", pointerof(@debug_window))
|
||||||
ImGui.text("Palettes")
|
if ImGui.begin_tab_bar "VideoTabBar"
|
||||||
ImGui.push_style_var(ImGui::ImGuiStyleVar::ItemSpacing, ImGui::ImVec2.new(0, 0))
|
render_palettes_tab_item if ImGui.begin_tab_item "Palettes"
|
||||||
pram = @emu.ppu.pram.to_unsafe.as(UInt16*)
|
ImGui.end_tab_bar
|
||||||
flags = ImGui::ImGuiColorEditFlags::NoAlpha | ImGui::ImGuiColorEditFlags::NoPicker |
|
|
||||||
ImGui::ImGuiColorEditFlags::NoOptions | ImGui::ImGuiColorEditFlags::NoInputs |
|
|
||||||
ImGui::ImGuiColorEditFlags::NoLabel | ImGui::ImGuiColorEditFlags::NoSidePreview |
|
|
||||||
ImGui::ImGuiColorEditFlags::NoDragDrop | ImGui::ImGuiColorEditFlags::NoBorder
|
|
||||||
2.times do |idx|
|
|
||||||
ImGui.begin_group
|
|
||||||
16.times do |palette_row|
|
|
||||||
16.times do |palette_col|
|
|
||||||
color = (pram + 0x100 * idx)[palette_row * 16 + palette_col]
|
|
||||||
rgb = ImGui::ImVec4.new((color & 0x1F) / 0x1F, (color >> 5 & 0x1F) / 0x1F, (color >> 10 & 0x1F) / 0x1F, 1)
|
|
||||||
ImGui.color_button("", rgb, flags, ImGui::ImVec2.new(10, 10))
|
|
||||||
ImGui.same_line unless palette_col == 15
|
|
||||||
end
|
|
||||||
end
|
|
||||||
ImGui.end_group
|
|
||||||
ImGui.same_line(spacing: 4_f32) if idx == 0
|
|
||||||
end
|
end
|
||||||
ImGui.pop_style_var
|
|
||||||
ImGui.end
|
ImGui.end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private def render_palettes_tab_item : Nil
|
||||||
|
ImGui.push_style_var(ImGui::ImGuiStyleVar::ItemSpacing, ImGui::ImVec2.new(0, 0))
|
||||||
|
pram = @emu.ppu.pram.to_unsafe.as(UInt16*)
|
||||||
|
flags = ImGui::ImGuiColorEditFlags::NoAlpha | ImGui::ImGuiColorEditFlags::NoPicker |
|
||||||
|
ImGui::ImGuiColorEditFlags::NoOptions | ImGui::ImGuiColorEditFlags::NoInputs |
|
||||||
|
ImGui::ImGuiColorEditFlags::NoLabel | ImGui::ImGuiColorEditFlags::NoSidePreview |
|
||||||
|
ImGui::ImGuiColorEditFlags::NoDragDrop | ImGui::ImGuiColorEditFlags::NoBorder
|
||||||
|
2.times do |idx|
|
||||||
|
ImGui.begin_group
|
||||||
|
16.times do |palette_row|
|
||||||
|
16.times do |palette_col|
|
||||||
|
color = (pram + 0x100 * idx)[palette_row * 16 + palette_col]
|
||||||
|
rgb = ImGui::ImVec4.new((color & 0x1F) / 0x1F, (color >> 5 & 0x1F) / 0x1F, (color >> 10 & 0x1F) / 0x1F, 1)
|
||||||
|
ImGui.color_button("", rgb, flags, ImGui::ImVec2.new(10, 10))
|
||||||
|
ImGui.same_line unless palette_col == 15
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ImGui.end_group
|
||||||
|
ImGui.same_line(spacing: 4_f32) if idx == 0
|
||||||
|
end
|
||||||
|
ImGui.pop_style_var
|
||||||
|
ImGui.end_tab_item
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue