Skip to content

Commit

Permalink
Added "orDown" methods
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Nov 4, 2023
1 parent 07ff32b commit b9e17c2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/dn/heaps/input/ControllerQueue.hx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ class ControllerQueue<T:Int> {
return pressed;
}

/**
Same as `consumePressOrDown` but also returns TRUE if the action button is currently down.
**/
public inline function consumePressOrDown(action:T, ignoreChronologicalOrder=false) {
if( consumePress(action,ignoreChronologicalOrder) )
return true;
else
return ca.isDown(action);
}


/**
Check if the `action` press event is in the queue. This method doesn't "consume" the event from the queue.
Expand All @@ -96,6 +106,13 @@ class ControllerQueue<T:Int> {
return events.get(action).peekPress(curTimeS);
}

/**
Same as `peekPress` but also returns TRUE if the action button is currently down.
**/
public inline function peekPressOrDown(action:T, ignoreChronologicalOrder=false) {
return ca.isDown(action) || peekPress(action, ignoreChronologicalOrder);
}


public function clearAllQueues() {
for(ev in events)
Expand Down

0 comments on commit b9e17c2

Please sign in to comment.