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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
// -----------------------------------------------------------------------------
// File: input.ss
// Description: abstract input system (Debug Mode)
// Author: Alexandre Martins <http://opensurge2d.org>
// License: MIT
// -----------------------------------------------------------------------------
/*
The following button names are available:
"up", "right", "down", "left",
"action", "secondary-action",
"back"
*/
using SurgeEngine.Input;
object "Debug Mode - Input" is "debug-mode-utility"
{
inputA = Input("default");
inputB = Input("Debug Mode");
buttonMapping = {
"up": [ "up", "up" ],
"right": [ "right", "right" ],
"down": [ "down", "down" ],
"left": [ "left", "left" ],
"action": [ "fire1", "" ],
"secondary-action": [ "fire2", "fire2" ],
"back": [ "fire4", "fire4" ],
};
state "main"
{
if(timeout(0.5)) {
inputA.enabled = true;
inputB.enabled = true;
state = "enabled";
}
}
state "enabled"
{
}
fun buttonDown(buttonName)
{
button = buttonMapping[buttonName];
return inputA.buttonDown(button[0]) || inputB.buttonDown(button[1]);
}
fun buttonPressed(buttonName)
{
button = buttonMapping[buttonName];
return inputA.buttonPressed(button[0]) || inputB.buttonPressed(button[1]);
}
fun buttonReleased(buttonName)
{
button = buttonMapping[buttonName];
return inputA.buttonReleased(button[0]) || inputB.buttonReleased(button[1]);
}
fun constructor()
{
inputA.enabled = false;
inputB.enabled = false;
}
}
|