Skip to content

Commit

Permalink
Removed release support in queue
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Nov 6, 2023
1 parent 2933a56 commit b99c01b
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/dn/heaps/input/ControllerQueue.hx
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,11 @@ class ControllerQueue<T:Int> {


/**
Manually insert fake press/release event
Manually insert fake press event
**/
public function emulatePressRelease(a:T) {
if( events.exists(a) ) {
public function emulatePress(a:T) {
if( events.exists(a) )
events.get(a).presses.push(curTimeS);
events.get(a).releases.push(curTimeS+0.06);
}
}


Expand All @@ -157,7 +155,7 @@ class ControllerQueue<T:Int> {
var rowWrapper = new h2d.Object(wrapper);
rowWrapper.y = i*lineHei;

var rowColor : Col = ev.peekPress(curTimeS) || ev.peekRelease(curTimeS) ? Green : Red;
var rowColor : Col = ev.peekPress(curTimeS) ? Green : Red;

// Full line bg
var bg = new h2d.Graphics(rowWrapper);
Expand Down Expand Up @@ -222,7 +220,6 @@ class ControllerQueue<T:Int> {
eventIdx++;
}
_renderStack(ev.presses, 0, Green);
_renderStack(ev.releases, 1, Orange);

i++;
}
Expand All @@ -240,13 +237,11 @@ private class QueueEventStacks<T> {
public var action(default,null) : T;
var wasDown = false;
public var presses(default,null) : Array<Float>;
public var releases(default,null) : Array<Float>;
public var maxKeepDurationS(default,null) : Float;

public function new(a:T, maxKeepDurationS:Float) {
action = a;
presses = [];
releases = [];
this.maxKeepDurationS = maxKeepDurationS;
}

Expand All @@ -259,11 +254,8 @@ private class QueueEventStacks<T> {
}

public function onUp(curTimeS:Float) {
if( wasDown ) {
if( wasDown )
wasDown = false;
releases.push(curTimeS);
gc(releases, curTimeS);
}
}


Expand All @@ -272,10 +264,7 @@ private class QueueEventStacks<T> {
}

public inline function popPress(curTimeS:Float) return popFromStack(presses,curTimeS);
public inline function popRelease(curTimeS:Float) return popFromStack(releases,curTimeS);

public inline function peekPress(curTimeS:Float) return peekFromStack(presses,curTimeS);
public inline function peekRelease(curTimeS:Float) return peekFromStack(releases,curTimeS);

function popFromStack(stack:Array<Float>, curTimeS:Float) : Bool {
gc(stack,curTimeS);
Expand Down Expand Up @@ -308,6 +297,5 @@ private class QueueEventStacks<T> {
public function clear() {
wasDown = false;
presses = [];
releases = [];
}
}

0 comments on commit b99c01b

Please sign in to comment.