InputStroke.isDown

Check if all keys or buttons required for the stroke are held down.

struct InputStroke
const
bool
isDown

Examples

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

// No keys pressed
assert(!stroke.isDown(io));

// Control pressed
io.press(KeyboardKey.leftControl);
assert(!stroke.isDown(io));

// Both keys pressed
io.press(KeyboardKey.w);
assert(stroke.isDown(io));

// Still pressed, but not immediately
io.nextFrame;
assert(stroke.isDown(io));

// W pressed
io.release(KeyboardKey.leftControl);
assert(!stroke.isDown(io));

Meta