LameControl¶
Use the LameStation's joystick and buttons.
ctrl : "LameControl"
The LameStation has six hardware controls for user input.
About¶
Before you can use them, you must call ctrl.Start
once at the beginning of
your program. This tells the Propeller to listen to the controls.
To read the current state of the controls, call ctrl.Update
. A good place to
do this is at the beginning of your main game loop, but it can be called at any
time. If this is never called, button functions will always return false.
PUB Main
repeat
ctrl.Update
After calling ctrl.Update
, you can call any of the button or joystick commands to get their state. The values returned will not update until ctrl.Update
is called again.
if ctrl.Up
' jump really high
if ctrl.A or ctrl.B
' do something
Functions¶
ctrl.Start¶
Start the LameControl library.
ctrl.Start
ctrl.Update¶
Update the state of all controls.
ctrl.Update
ctrl.WaitKey¶
Wait until A
or B
button is pressed.
ctrl.WaitKey
ctrl.A¶
Returns true if the 'A' button is pressed.
ctrl.A
ctrl.B¶
Returns true if the 'B' button is pressed.
ctrl.B
ctrl.Down¶
Returns true if the joystick is tilted down.
ctrl.Down
ctrl.Left¶
Returns true if the joystick is tilted left.
ctrl.Left
ctrl.Right¶
Returns true if the joystick is tilted right.
ctrl.Right
ctrl.Up¶
Returns true if the joystick is tilted up.
ctrl.Up