Files
i-mic-fps/lib/tools/asset_viewer/lib/main_menu.rb
2020-12-02 17:37:48 -06:00

50 lines
1.2 KiB
Ruby

# frozen_string_literal: true
class IMICFPS
class AssetViewerTool
class MainMenu < Menu
def setup
window.needs_cursor = true
@manifests = []
Dir.glob("#{GAME_ROOT_PATH}/assets/**/manifest.yaml").each do |manifest|
begin
@manifests << Manifest.new(manifest_file: manifest)
rescue StandardError
warn "Broken manifest: #{manifest}"
end
end
@manifests.sort_by! { |m| m.name.downcase }
label IMICFPS::NAME.to_s, text_size: 100, color: Gosu::Color::BLACK
label "Asset Viewer", text_size: 50
flow(width: 1.0, height: 1.0) do
stack(width: 0.25, height: 1.0) do
button "Back", width: 1.0 do
pop_state
end
end
stack(width: 0.5, height: 1.0) do
flow(width: 1.0, height: 1.0) do
@manifests.each do |manifest|
button manifest.name do
push_state(TurnTable, manifest: manifest)
end
end
end
end
end
end
def update
super
window.needs_cursor = true
end
end
end
end