Handbook
Glossary
handle-input ( world -- )
Vocabulary
terrain
Inputs
world
an
object
Outputs
None
Definition
USING:
accessors
combinators.short-circuit
game.input
game.input.scancodes
kernel
sequences
ui
;
IN:
terrain
::
handle-input
( world -- )
world
player>>
:>
player
read-keyboard
keys>>
:>
keys
key-left-shift
keys
nth
VELOCITY-MODIFIER-FAST
VELOCITY-MODIFIER-NORMAL
?
player
velocity-modifier<<
{
[
key-1
keys
nth
1
f
?
]
[
key-2
keys
nth
2
f
?
]
[
key-3
keys
nth
3
f
?
]
[
key-4
keys
nth
4
f
?
]
[
key-5
keys
nth
10000
f
?
]
}
0||
player
reverse-time<<
key-w
keys
nth
[
player
walk-forward
]
when
key-s
keys
nth
[
player
walk-backward
]
when
key-a
keys
nth
[
player
walk-leftward
]
when
key-d
keys
nth
[
player
walk-rightward
]
when
key-q
keys
nth
[
player -1
look-horizontally
]
when
key-e
keys
nth
[
player 1
look-horizontally
]
when
key-left-arrow
keys
nth
[
player -1
look-horizontally
]
when
key-right-arrow
keys
nth
[
player 1
look-horizontally
]
when
key-down-arrow
keys
nth
[
player 1
look-vertically
]
when
key-up-arrow
keys
nth
[
player -1
look-vertically
]
when
key-space
keys
nth
[
player
jump
]
when
key-escape
keys
nth
[
world
close-window
]
when
player
read-mouse
rotate-with-mouse
reset-mouse
;