-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathkeyboard.rb
38 lines (26 loc) · 1.33 KB
/
keyboard.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module GTK
class Keyboard
# @return [Integer] Returns Kernel.tick_count if any keys on the keyboard were pressed.
attr_reader :active
# @return [Boolean] Returns true if the game has keyboard focus.
attr_reader :has_focus
# @return [Integer, false] Returns the tickstamp of the keypress if up or w is pressed or held on the keyboard.
attr_reader :up
# @return [Integer, false] Returns the tickstamp of the keypress if down or s is pressed or held on the keyboard.
attr_reader :down
# @return [Integer, false] Returns the tickstamp of the keypress if left or a is pressed or held on the keyboard.
attr_reader :left
# @return [Integer, false] Returns the tickstamp of the keypress if right or d is pressed or held on the keyboard.
attr_reader :right
# @return [Integer] Returns -1 (left), 0 (neutral), or +1 (right) depending on results of #left and #right.
attr_reader :left_right
# @return [Integer] Returns -1 (left), 0 (neutral), or +1 (right) depending on results of #up and #up.
attr_reader :up_down
attr_reader :key_down
attr_reader :key_held
attr_reader :key_up
# @return [Hash] Returns a Hash with all keys on the keyboard in their respective state.
# The Hash contains the following keys: :down, :held, :down_or_held, :up
attr_reader :keys
end
end