add additional functionality to tap detection (#375)

This commit is contained in:
Collin Kees authored and GitHub committed 2022-12-16 16:37:36 +03:00
1 parent f273d3a9bb
commit 88f649ae5c
11 files changed
+481 -91

No files matched your search

@@ -1,23 +1,99 @@
package dev.slimevr.config;
import com.jme3.math.FastMath;
// handles the tap detection config
// this involves the number of taps, the delay, and whether or not the feature is enabled
// for each reset type
public class TapDetectionConfig {
private float delay = 0.2f;
private boolean enabled = true;
private float quickResetDelay = 0.2f;
private float resetDelay = 1.0f;
private float mountingResetDelay = 1.0f;
private boolean quickResetEnabled = true;
private boolean resetEnabled = true;
private boolean mountingResetEnabled = true;
private int quickResetTaps = 2;
private int resetTaps = 3;
private int mountingResetTaps = 3;
public float getDelay() {
return delay;
public float getQuickResetDelay() {
return quickResetDelay;
}
public void setDelay(float delay) {
this.delay = delay;
public void setQuickResetDelay(float quickResetDelay) {
this.quickResetDelay = quickResetDelay;
}
public boolean getEnabled() {
return enabled;
public float getResetDelay() {
return resetDelay;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
public void setResetDelay(float resetDelay) {
this.resetDelay = resetDelay;
}
public float getMountingResetDelay() {
return mountingResetDelay;
}
public void setMountingResetDelay(float mountingResetDelay) {
this.mountingResetDelay = mountingResetDelay;
}
public boolean getQuickResetEnabled() {
return quickResetEnabled;
}
public void setQuickResetEnabled(boolean quickResetEnabled) {
this.quickResetEnabled = quickResetEnabled;
}
public boolean getResetEnabled() {
return resetEnabled;
}
public void setResetEnabled(boolean resetEnabled) {
this.resetEnabled = resetEnabled;
}
public boolean getMountingResetEnabled() {
return mountingResetEnabled;
}
public void setMountingResetEnabled(boolean mountingResetEnabled) {
this.mountingResetEnabled = mountingResetEnabled;
}
public int getQuickResetTaps() {
return quickResetTaps;
}
// clamp to 2-3 to prevent errors
public void setQuickResetTaps(int quickResetTaps) {
if (quickResetTaps > 3 || quickResetTaps < 2)
FastMath.clamp(quickResetTaps, 2, 3);
this.quickResetTaps = quickResetTaps;
}
public int getResetTaps() {
return resetTaps;
}
public void setResetTaps(int resetTaps) {
if (resetTaps > 3 || resetTaps < 2)
FastMath.clamp(resetTaps, 2, 3);
this.resetTaps = resetTaps;
}
public int getMountingResetTaps() {
return mountingResetTaps;
}
public void setMountingResetTaps(int mountingResetTaps) {
if (mountingResetTaps > 3 || mountingResetTaps < 2)
FastMath.clamp(mountingResetTaps, 2, 3);
this.mountingResetTaps = mountingResetTaps;
}
}