Class: Gemba::MainWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/gemba/main_window.rb

Overview

Pure Tk shell — creates the app window and hosts a FrameStack.

MainWindow knows nothing about ROMs, emulation, menus, or config. It provides geometry/title/fullscreen primitives that the AppController drives. Its only structural contribution is the FrameStack, which manages show/hide transitions to prevent visual flash (FOUC).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMainWindow

Returns a new instance of MainWindow.



14
15
16
17
18
# File 'lib/gemba/main_window.rb', line 14

def initialize
  @app = Teek::App.new
  @app.show
  @frame_stack = FrameStack.new
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



12
13
14
# File 'lib/gemba/main_window.rb', line 12

def app
  @app
end

#frame_stackObject (readonly)

Returns the value of attribute frame_stack.



12
13
14
# File 'lib/gemba/main_window.rb', line 12

def frame_stack
  @frame_stack
end

Instance Method Details

#fullscreen=(val) ⇒ Object



48
49
50
# File 'lib/gemba/main_window.rb', line 48

def fullscreen=(val)
  @app.command(:wm, 'attributes', '.', '-fullscreen', val ? 1 : 0)
end

#mainloopObject



52
53
54
# File 'lib/gemba/main_window.rb', line 52

def mainloop
  @app.mainloop
end

#reset_aspect_ratioObject



40
41
42
# File 'lib/gemba/main_window.rb', line 40

def reset_aspect_ratio
  @app.command(:wm, 'aspect', '.', '', '', '', '')
end

#reset_minsizeObject



36
37
38
# File 'lib/gemba/main_window.rb', line 36

def reset_minsize
  @app.command(:wm, 'minsize', '.', 0, 0)
end

#set_aspect(numer, denom) ⇒ Object



28
29
30
# File 'lib/gemba/main_window.rb', line 28

def set_aspect(numer, denom)
  @app.command(:wm, 'aspect', '.', numer, denom, numer, denom)
end

#set_geometry(w, h) ⇒ Object



24
25
26
# File 'lib/gemba/main_window.rb', line 24

def set_geometry(w, h)
  @app.set_window_geometry("#{w}x#{h}")
end

#set_minsize(w, h) ⇒ Object



32
33
34
# File 'lib/gemba/main_window.rb', line 32

def set_minsize(w, h)
  @app.command(:wm, 'minsize', '.', w, h)
end

#set_timer_speed(ms) ⇒ Object



44
45
46
# File 'lib/gemba/main_window.rb', line 44

def set_timer_speed(ms)
  @app.interp.thread_timer_ms = ms
end

#set_title(title) ⇒ Object



20
21
22
# File 'lib/gemba/main_window.rb', line 20

def set_title(title)
  @app.set_window_title(title)
end