Module: Carbuncle::Keyboard

Defined in:
gems/carbuncle-input/mrblib/keyboard.rb

Constant Summary collapse

BACKSPACE =

Note that the numbers are suggestions, and dependant on your platform. Don’t use numbers directly, use the constant or the symbol when handling keyboard input. This are in the documentation as a reference.

Examples:

# Use this:
Carbuncle::Keyboard.press?(:a) # => Cross platform!
# Over this:
Carbuncle::Keyboard.press?(65) # => Only works if A is mapped to the index 65!
0
SPACE =
1
ESCAPE =
2
ESC =
3
ENTER =
4
RETURN =
5
DELETE =
6
DEL =
7
RIGHT =
8
LEFT =
9
DOWN =
10
UP =
11
ARROW_RIGHT =
8
ARROW_LEFT =
9
ARROW_DOWN =
10
ARROW_UP =
11
RIGHT_ARROW =
8
LEFT_ARROW =
9
DOWN_ARROW =
10
UP_ARROW =
11
F1 =
12
F2 =
13
F3 =
14
F4 =
15
F5 =
16
F6 =
17
F7 =
18
F8 =
19
F9 =
20
F10 =
21
F11 =
22
F12 =
23
LEFT_SHIFT =
24
LEFT_CONTROL =
25
LEFT_ALT =
26
RIGHT_SHIFT =
27
RIGHT_CONTROL =
28
RIGHT_ALT =
29
ZERO =
91
ONE =
92
TWO =
93
THREE =
94
FOUR =
95
FIVE =
96
SIX =
97
SEVEN =
98
EIGHT =
99
NINE =
100
A =
65
B =
66
C =
67
D =
68
E =
69
F =
70
G =
71
H =
72
I =
73
J =
74
K =
75
L =
76
M =
77
N =
78
O =
79
P =
80
Q =
81
R =
82
S =
83
T =
84
U =
85
V =
86
W =
87
X =
88
Y =
89
Z =
90

Class Method Summary collapse

Class Method Details

.all_down?(*args) ⇒ Boolean

Checks if all of the keys are down.

Returns:

  • (Boolean)

See Also:

  • down?


28
29
30
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 28

def all_down?(*args)
  args.all?(&method(:down?))
end

.all_press?(*args) ⇒ Boolean

Checks if all of the keys are pressed.

Returns:

  • (Boolean)

See Also:

  • press?


14
15
16
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 14

def all_press?(*args)
  args.all?(&method(:press?))
end

.all_release?(*args) ⇒ Boolean

Checks if all of the keys are released.

Returns:

  • (Boolean)

See Also:

  • release?


42
43
44
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 42

def all_release?(*args)
  args.all?(&method(:release?))
end

.all_up?(*args) ⇒ Boolean

Checks if all of the keys are up.

Returns:

  • (Boolean)

See Also:

  • up?


56
57
58
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 56

def all_up?(*args)
  args.all?(&method(:up?))
end

.any_down?(*args) ⇒ Boolean

Checks if any of the keys are down.

Returns:

  • (Boolean)

See Also:

  • down?


21
22
23
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 21

def any_down?(*args)
  args.any?(&method(:down?))
end

.any_press?(*args) ⇒ Boolean

Checks if any of the keys are pressed.

Returns:

  • (Boolean)

See Also:

  • press?


7
8
9
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 7

def any_press?(*args)
  args.any?(&method(:press?))
end

.any_release?(*args) ⇒ Boolean

Checks if any of the keys are released.

Returns:

  • (Boolean)

See Also:

  • release?


35
36
37
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 35

def any_release?(*args)
  args.any?(&method(:release?))
end

.any_up?(*args) ⇒ Boolean

Checks if any of the keys are up.

Returns:

  • (Boolean)

See Also:

  • up?


49
50
51
# File 'gems/carbuncle-input/mrblib/keyboard.rb', line 49

def any_up?(*args)
  args.any?(&method(:up?))
end