SCA_InputEvent(EXP_PyObjectPlus)

base class — EXP_PyObjectPlus

class bge.types.SCA_InputEvent

Events for a keyboard or mouse input.

status

A list of existing status of the input from the last frame. Can contain bge.logic.KX_INPUT_NONE and bge.logic.KX_INPUT_ACTIVE. The list always contains one value. The first value of the list is the last value of the list in the last frame. (read-only)

Type:

list of integer.

queue

A list of existing events of the input from the last frame. Can contain bge.logic.KX_INPUT_JUST_ACTIVATED and bge.logic.KX_INPUT_JUST_RELEASED. The list can be empty. (read-only)

Type:

list of integer.

values

A list of existing value of the input from the last frame. For keyboard it contains 1 or 0 and for mouse the coordinate of the mouse or the movement of the wheel mouse. The list contains always one value, the size of the list is the same than queue + 1 only for keyboard inputs. The first value of the list is the last value of the list in the last frame. (read-only)

Example to get the non-normalized mouse coordinates:

import bge

x = bge.logic.mouse.inputs[bge.events.MOUSEX].values[-1]
y = bge.logic.mouse.inputs[bge.events.MOUSEY].values[-1]

print("Mouse non-normalized position: x: {0}, y: {1}".format(x, y))
Type:

list of integer.

inactive

True if the input was inactive from the last frame.

Type:

boolean

active

True if the input was active from the last frame.

Type:

boolean

activated

True if the input was activated from the last frame.

Type:

boolean

released

True if the input was released from the last frame.

Type:

boolean

Example to execute some action when I click or release mouse left button:

import bge

mouse = bge.logic.mouse.inputs
mouse_left_button = mouse[bge.events.LEFTMOUSE]

if mouse_left_button.activated:
   # ...
elif mouse_left_button.active:
   # ...
elif mouse_left_button.released:
   # ...
elif mouse_left_button.inactive:
   # ...
type

The type of the input. One of these constants

Type:

integer