Class: Spacy::Window
- Inherits:
-
Reflex::Window
- Object
- Reflex::Window
- Spacy::Window
- Defined in:
- lib/spacy/window.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ Window
constructor
A new instance of Window.
- #on_draw(e) ⇒ Object
- #on_key_down(e) ⇒ Object
- #on_key_up(e) ⇒ Object
- #on_pointer_down(e) ⇒ Object
- #on_pointer_move(e) ⇒ Object
- #on_pointer_up(e) ⇒ Object
- #on_update(e) ⇒ Object
Constructor Details
#initialize ⇒ Window
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/spacy/window.rb', line 16 def initialize () super set :title, Reflex::Application.instance.name set :frame, 100, 100, 600, 500 @text = Text.new p = painter p.background 1 p.fill 0 p.stroke nil p.font Rays::Font.new "Menlo", 12 end |
Instance Method Details
#close ⇒ Object
28 29 30 31 |
# File 'lib/spacy/window.rb', line 28 def close () #Profiler__.print_profile STDOUT super end |
#on_draw(e) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/spacy/window.rb', line 37 def on_draw (e) super p = e.painter h = p.font.height draw_text p, h draw_cursor p, h draw_fps p, e.fps end |
#on_key_down(e) ⇒ Object
46 47 48 |
# File 'lib/spacy/window.rb', line 46 def on_key_down (e) @text.selection = e.chars end |
#on_key_up(e) ⇒ Object
50 51 |
# File 'lib/spacy/window.rb', line 50 def on_key_up (e) end |
#on_pointer_down(e) ⇒ Object
53 54 |
# File 'lib/spacy/window.rb', line 53 def on_pointer_down (e) end |
#on_pointer_move(e) ⇒ Object
59 60 |
# File 'lib/spacy/window.rb', line 59 def on_pointer_move (e) end |
#on_pointer_up(e) ⇒ Object
56 57 |
# File 'lib/spacy/window.rb', line 56 def on_pointer_up (e) end |
#on_update(e) ⇒ Object
33 34 35 |
# File 'lib/spacy/window.rb', line 33 def on_update (e) redraw end |