mirror of
https://github.com/mattrberry/crab.git
synced 2024-12-27 09:58:55 +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
|
||||
|
||||
def render_debug_items : Nil
|
||||
ImGui.menu_item("Debug", "", pointerof(@debug_window))
|
||||
ImGui.menu_item("Video", "", pointerof(@debug_window))
|
||||
end
|
||||
|
||||
def render_windows : Nil
|
||||
if @debug_window
|
||||
ImGui.begin("Debug", pointerof(@debug_window))
|
||||
ImGui.text("Palettes")
|
||||
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
|
||||
ImGui.begin("Video", pointerof(@debug_window))
|
||||
if ImGui.begin_tab_bar "VideoTabBar"
|
||||
render_palettes_tab_item if ImGui.begin_tab_item "Palettes"
|
||||
ImGui.end_tab_bar
|
||||
end
|
||||
ImGui.pop_style_var
|
||||
ImGui.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
|
||||
|
|
Loading…
Reference in a new issue