LIL is a Language Make games, nicely

@input

This class has storage for the states of the keys of the keyboard, the mouse and gamepads.

Example code

var gamepad: input.getGamepad();

if input.getMousePressed() {
	someObj.setX(input.getMouseX());
	someObj.setY(input.getMouseY());
}

Member variables

  • keyStates

    Type: var.[65536 x bool]

    Storage for the press status of each key on the keyboard.

    @self.keyStates[keyCode]: value;
  • gamepads

    Type: var.[8 x @gamepad]

    Storage for the states of the gamepads.

    @self.gamepads[gamepadId].buttonStates[buttonId]: value;
  • gamepadCount

    Type: var.i64

    The amount of gamepads that are currently in use.

    input.gamepadCount +: 1;
  • mouseStates

    Type: var.[8 x @mouseState]

    Storage for the button states and location of the mouse.

    input.mouseStates[buttonNumber]: @mouseState {
    	x: x;
    	y: y;
    	pressed: true;
    };

Member functions

  • isKeyDown

    Type: fn(i16) => bool

    Returns wether the key with the given code is pressed.

    Arguments
    • var.i16 keyCode:

      The number identifying which key.

    if input.isKeyDown(KeyBoard.enter) {
    	print "key down";
    }
  • setKeyDown

    Type: fn(i16,bool)

    Sets the press status of the key on the keyboard with the given keyCode.

    Arguments
    • var.i16 keyCode:

      The number identifying which key.

    • var.bool value:

      Wether it is pressed or not.

    inut.setKeyDown(keyCode, value);
  • getGamepad

    Type: fn(i64) => @gamepad

    Returns the gamepad object for the given gamepadId.

    Arguments
    • var.i64 gamepadId:

      The number identifying the gamepad. Defaults to 0.

    //get the first gamepad
    var gamepad: input.getGamepad();
    //get the second one
    var gamepad2: input.getGamepad(1);
    
  • isGamepadButtonDown

    Type: fn(i64,i64) => bool

    Returns the gamepad object for the given gamepadId.

    Arguments
    • var.i64 gamepadId:

      The number identifying the gamepad.

    • var.i64 buttonId:

      The number identifying the button of the gamepad.

    if input.isGamepadButtonDown(0, 3) {
    	//etc
    }
  • setGamepadButtonDown

    Type: fn(i64,i64,bool)

    Sets the press state of the button with given buttonId on the gamepad with given gamepadId.

    Arguments
    • var.i64 gamepadId:

      The number identifying the gamepad.

    • var.i64 buttonId:

      The number identifying the button of the gamepad.

    • var.bool value:

      Wether or not it is pressed.

    input.setGamepadButtonDown(gamepadId: 0; buttonId: 1; value: true);
  • setGamepadX

    Type: fn(i64,f64)

    Sets the position of the thumbstick in the horizontal axis for the gamepad with given gamepadId.

    Arguments
    • var.i64 gamepadId:

      The number identifying the gamepad.

    • var.f64 value:

      The number representing the x amount. Valid values are between 0.0 and 1.0;

    input.setGamepadX(0, 0.5);
  • setGamepadY

    Type: fn(i64,f64)

    Sets the position of the thumbstick in the vertical axis for the gamepad with given gamepadId.

    Arguments
    • var.i64 gamepadId:

      The number identifying the gamepad.

    • var.f64 value:

      The number representing the y amount. Valid values are between 0.0 and 1.0;

    input.setGamepadY(0, 1.0);
  • setGamepadX2

    Type: fn(i64,f64)

    Sets the position of the second thumbstick in the horizontal axis for the gamepad with given gamepadId.

    Arguments
    • var.i64 gamepadId:

      The number identifying the gamepad.

    • var.f64 value:

      The number representing the x amount. Valid values are between 0.0 and 1.0;

    input.setGamepadX2(0, 0);
  • setGamepadY2

    Type: fn(i64,f64)

    Sets the position of the second thumbstick in the vertical axis for the gamepad with given gamepadId.

    Arguments
    • var.i64 gamepadId:

      The number identifying the gamepad.

    • var.f64 value:

      The number representing the y amount. Valid values are between 0.0 and 1.0;

    input.setGamepadY2(0, 0);
  • getMouseX

    Type: fn(i64) => f64

    Returns the location on the horizontal axis of the mouse cursor, in window coordinates.

    Arguments
    • var.i64 num:

      The button number. Defaults to 0. The x and y coordinates of the mouse cursor are stored at index 0.

    print input.getMouseX();
  • getMouseY

    Type: fn(i64) => f64

    Returns the location on the vertical axis of the mouse cursor, in window coordinates.

    Arguments
    • var.i64 num:

      The button number. Defaults to 0. The x and y coordinates of the mouse cursor are stored at index 0.

    print input.getMouseY();
  • getMousePressed

    Type: fn(i64) => bool

    Returns the press state of the button with given numnber of the mouse.

    Arguments
    • var.i64 num:

      The button number.

    if getMousePressed(0) {
    	//etc
    }
  • setMousePosition

    Type: fn(i64,f64,f64)

    Sets the x and y coordinates for the mouse. Use window coordinates.

    Arguments
    • var.i64 num:

      The button number. Defaults to 0. The x and y coordinates of the mouse cursor are stored at index 0.

    • var.f64 x:

      The number representing the x coordinate.

    • var.f64 y:

      The number representing the y coordinate.