InputStroke.isActive

Check if the stroke has been triggered during this frame.

If the last item of the action is a mouse button, the action will be triggered on release. If it's a keyboard key or gamepad button, it'll be triggered on press. All previous items, if present, have to be held down at the time.

struct InputStroke
const @trusted
bool
isActive

Examples

Mouse actions are activated on release

auto stroke = InputStroke(KeyboardKey.leftControl, MouseButton.left);
auto io = new HeadlessBackend;

assert(!stroke.isActive(io));

io.press(KeyboardKey.leftControl);
io.press(MouseButton.left);

assert(!stroke.isActive(io));

io.release(MouseButton.left);

assert(stroke.isActive(io));

// The action won't trigger if previous keys aren't held down
io.release(KeyboardKey.leftControl);

assert(!stroke.isActive(io));

Meta