package dasherJava.core.input; import dasherJava.core.startStop.StartStopAction; public interface InputProvider { float getInputX(); float getInputY(); StartStopAction getStartStopAction(); static float mapToInputRange(float value, float inMin, float inMax) { //maps to range [-1.0, 1.0] return (value-inMin)*2.0f/(inMax-inMin)-1.0f; } static float mapToOtherRange(float value, float outMin, float outMax) { //maps from [-1.0, 1.0] to the given range return (value+1.0f)*(outMax-outMin)/2.0f+outMin; } static float clampToInputRange(float value) { return Math.max(-1.0f, Math.min(value, 1.0f)); } }