Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Nov 3, 2023
1 parent a281870 commit 95e41b7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/dn/heaps/input/ControllerQueue.hx
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ class ControllerQueue<T:Int> {
if( ev.action!=action && ev.getNextPress()<nextT )
return false;
}
var result = events.get(action).popPress(curTimeS);
if( result )
var pressed = events.get(action).popPress(curTimeS);
if( ignoreChronologicalOrder && pressed )
for(ev in events)
ev.discardPressesEarlier(nextT);
ev.clearStackUntil(ev.presses, nextT);

return result;
return pressed;
}


Expand All @@ -97,16 +97,17 @@ class ControllerQueue<T:Int> {
}


public function clearAll() {
public function clearAllQueues() {
for(ev in events)
ev.clear();
}

public function clearAction(a:T) {
public function clearQueue(a:T) {
if( events.exists(a) )
events.get(a).clear();
}


public function createDebugger(parent:dn.Process) {
var p = parent.createChildProcess();
p.createRootInLayers(parent.root, 99999);
Expand Down Expand Up @@ -248,9 +249,9 @@ private class QueueEventStacks<T> {
return false;
}

public function discardPressesEarlier(t:Float) {
while( presses.length>0 && presses[0]<=t )
presses.shift();
public function clearStackUntil(stack:Array<Float>, timeS:Float) {
while( stack.length>0 && stack[0]<=timeS )
stack.shift();
}

public inline function gc(stack:Array<Float>, curTimeS:Float) {
Expand Down

0 comments on commit 95e41b7

Please sign in to comment.