Class: Gemba::SaveStatePicker
- Inherits:
-
Object
- Object
- Gemba::SaveStatePicker
- Includes:
- ChildWindow, Locale::Translatable
- Defined in:
- lib/gemba/save_state_picker.rb
Overview
Grid picker window for save state slots.
Displays up to 10 slots in a 2×5 grid. Each cell shows a PNG thumbnail screenshot, the slot number, and the save timestamp —or an “Empty” placeholder. Left-click a populated slot to load, click an empty slot to save. The current quick-save slot is highlighted with a distinct border.
Uses native Tk photo images for thumbnails (loaded via ‘image create photo -file`). Pure Tk — no SDL2.
Constant Summary collapse
- TOP =
".mgba_state_picker"- THUMB_W =
Thumbnail size: half of native GBA resolution (240×160)
120- THUMB_H =
80- COLS =
5- ROWS =
2- SLOTS =
10
Instance Method Summary collapse
- #hide ⇒ Object
-
#initialize(app, callbacks: {}) ⇒ SaveStatePicker
constructor
A new instance of SaveStatePicker.
- #show(state_dir:, quick_slot: 1) ⇒ Object
Methods included from ChildWindow
#build_toplevel, #hide_window, #position_near_parent, #show_window
Constructor Details
#initialize(app, callbacks: {}) ⇒ SaveStatePicker
Returns a new instance of SaveStatePicker.
32 33 34 35 36 37 38 39 |
# File 'lib/gemba/save_state_picker.rb', line 32 def initialize(app, callbacks: {}) @app = app @callbacks = callbacks @built = false @photos = {} # slot => photo image name @cells = {} # slot => { frame:, thumb:, label:, time: } @quick_slot = 1 end |
Instance Method Details
#hide ⇒ Object
51 52 53 54 |
# File 'lib/gemba/save_state_picker.rb', line 51 def hide hide_window cleanup_photos end |
#show(state_dir:, quick_slot: 1) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/gemba/save_state_picker.rb', line 43 def show(state_dir:, quick_slot: 1) @state_dir = state_dir @quick_slot = quick_slot build_ui unless @built refresh show_window end |