Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/engineInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function inputClear()
* @memberof Input */
function keyIsDown(key, device=0)
{
ASSERT(isString(key), 'key must be a number or string');
ASSERT(isString(key) || isNumber(key), 'key must be a number or string');
ASSERT(device > 0 || typeof key !== 'number' || key < 3, 'use code string for keyboard');
return !!(inputData[device]?.[key] & 1);
}
Expand All @@ -115,7 +115,7 @@ function keyIsDown(key, device=0)
* @memberof Input */
function keyWasPressed(key, device=0)
{
ASSERT(isString(key), 'key must be a number or string');
ASSERT(isString(key) || isNumber(key), 'key must be a number or string');
ASSERT(device > 0 || typeof key !== 'number' || key < 3, 'use code string for keyboard');
return !!(inputData[device]?.[key] & 2);
}
Expand All @@ -127,7 +127,7 @@ function keyWasPressed(key, device=0)
* @memberof Input */
function keyWasReleased(key, device=0)
{
ASSERT(isString(key), 'key must be a number or string');
ASSERT(isString(key) || isNumber(key), 'key must be a number or string');
ASSERT(device > 0 || typeof key !== 'number' || key < 3, 'use code string for keyboard');
return !!(inputData[device]?.[key] & 4);
}
Expand Down