Class: RubySketch::VirtualKey::View

Inherits:
Reflex::View
  • Object
show all
Defined in:
lib/rubysketch/virtual_key.rb

Instance Method Summary collapse

Instance Method Details

#on_draw(e) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/rubysketch/virtual_key.rb', line 17

def on_draw(e)
  e.painter.push do |pa|
    pa.fill 1, 0.1
    draw_stick pa
    draw_buttons pa
  end
end

#on_pointer(e) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/rubysketch/virtual_key.rb', line 25

def on_pointer(e)
  e.pointers.each do |pointer|
    chars, key = get_chars_and_key pointer.pos
    @dispatcher.key_down chars, key if  key && e.down?
    @dispatcher.key_up   chars, key if !key || e.up?
  end
end

#on_resize(e) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/rubysketch/virtual_key.rb', line 8

def on_resize(e)
  @dispatcher    = VirtualKey::Dispatcher.new self
  @key_margin    =
  @key_size      =
  @stick_frame   =
  @buttons_frame = nil
  super
end