Module: Input
- Included in:
- SceneKBookPages
- Defined in:
- lib/games_paradise/gui/gosu/books/input.rb
Constant Summary collapse
{ down: Gosu::KbDown, left: Gosu::KbLeft, right: Gosu::KbRight, up: Gosu::KbUp, esc: Gosu::KbEscape, q: Gosu::KbQ, enter: Gosu::KbEnter, return: Gosu::KbReturn, spacebar: Gosu::KbSpace, left_alt: Gosu::KbLeftAlt, right_alt: Gosu::KbRightAlt, left_shift: Gosu::KbLeftShift, right_shift: Gosu::KbRightShift, left_ctrl: Gosu::KbLeftControl, right_ctrl: Gosu::KbRightControl, gp_down: Gosu::GP_DOWN, gp_left: Gosu::GP_LEFT, gp_right: Gosu::GP_RIGHT, gp_up: Gosu::GP_UP, gp_l1: Gosu::GP_BUTTON_4, gp_r1: Gosu::GP_BUTTON_5, gp_l2: Gosu::GP_BUTTON_6, gp_r2: Gosu::GP_BUTTON_7, gp_ok: Gosu::GP_BUTTON_1, gp_cancel: Gosu::GP_BUTTON_2 }
- @@down_id =
@@down_ticks = @@up_ticks = 0
- @@ticks_max =
3
Class Method Summary collapse
Instance Method Summary collapse
- #button_down(id) ⇒ Object
-
#button_down?(id) ⇒ Boolean
@@ticks_max / 2 end#@@ticks_max == 4.
- #button_up(id) ⇒ Object
-
#hold_down? ⇒ Boolean
hold_down?.
- #press_down? ⇒ Boolean
- #press_enter? ⇒ Boolean
- #press_kb_right? ⇒ Boolean
- #press_L1? ⇒ Boolean
- #press_left? ⇒ Boolean
- #press_quit? ⇒ Boolean
- #press_R1? ⇒ Boolean
- #press_right? ⇒ Boolean
- #press_up? ⇒ Boolean
Class Method Details
.[](sym) ⇒ Object
52 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 52 def self::[](sym) @@buttons[sym] end |
Instance Method Details
#button_down(id) ⇒ Object
31 32 33 34 35 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 31 def (id) @@last_down_id = @@down_id @@down_id = id @@down_ticks = @@ticks_max if @@down_ticks == 0 or @@last_down_id != id end |
#button_down?(id) ⇒ Boolean
@@ticks_max / 2 end#@@ticks_max == 4
50 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 50 def (id) @@buttons[id] == @@down_id and @@down_ticks > 1 end |
#button_up(id) ⇒ Object
51 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 51 def (id) @@down_id = nil end |
#hold_down? ⇒ Boolean
hold_down?
54 55 56 57 58 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 54 def hold_down? press = (:down) or (:gp_down) press ? @@down_ticks += 2 : return press = (:down) or (:gp_down) end |
#press_down? ⇒ Boolean
44 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 44 def press_down?() (:down) or (:gp_down) end |
#press_enter? ⇒ Boolean
37 38 39 40 41 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 37 def press_enter? return if Gosu::(@@buttons[:left_alt]) or Gosu::(@@buttons[:right_alt]) return true if (:enter) or (:return) return true if (:spacebar) or (:gp_ok) end |
#press_kb_right? ⇒ Boolean
47 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 47 def press_kb_right?() (:right) or (:gp_right) end |
#press_L1? ⇒ Boolean
48 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 48 def press_L1?() (:gp_l1) end |
#press_left? ⇒ Boolean
45 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 45 def press_left?() (:left) or (:gp_left) end |
#press_quit? ⇒ Boolean
42 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 42 def press_quit?() (:esc) or (:q) or (:gp_cancel) end |
#press_R1? ⇒ Boolean
49 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 49 def press_R1?() (:gp_r1) end |
#press_right? ⇒ Boolean
46 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 46 def press_right?() (:right) or (:gp_right) end |
#press_up? ⇒ Boolean
43 |
# File 'lib/games_paradise/gui/gosu/books/input.rb', line 43 def press_up?() (:up) or (:gp_up) end |