Renderer/src/main/java/electrosphere/controls/ScrollCallback.java
austin 7c8e536f80
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
bare minimum working ui update
2024-04-04 18:15:10 -04:00

45 lines
977 B
Java

package electrosphere.controls;
import org.lwjgl.glfw.GLFWScrollCallback;
/**
* A callback for scroll events from the mouse
*/
public class ScrollCallback extends GLFWScrollCallback {
//the offsets from the most recent scroll event
double offsetX = 0;
double offsetY = 0;
@Override
public void invoke(long window, double xoffset, double yoffset) {
offsetX = xoffset;
offsetY = yoffset;
}
/**
* The x offset from the scroll, !!setting the stored value to 0 in the process!!
* @return The x scroll offset
*/
public double getOffsetX(){
return offsetX;
}
/**
* The y offset from the scroll, !!setting the stored value to 0 in the process!!
* @return The y scroll offset
*/
public double getOffsetY(){
return offsetY;
}
/**
* Clears the data cached in the callback
*/
public void clear(){
offsetX = 0;
offsetY = 0;
}
}