PixelEngine/src/sig/engine/Mouse.java

28 lines
1.0 KiB
Java
Raw Normal View History

package sig.engine;
import java.util.HashMap;
public class Mouse {
public static int x;
public static int y;
public static HashMap<Integer,Boolean> clickMap=new HashMap<>();
public static HashMap<Integer,Boolean> pressMap=new HashMap<>();
public static HashMap<Integer,Boolean> releaseMap=new HashMap<>();
public static Point<Integer> mousePosition = new Point<Integer>(0,0);
public static Point<Integer> GetPos(){
return new Point<Integer>(x,y);
}
//0=Left click, 1=Right click, 2=Middle, 3=Button 4, 4=Button 5
public static boolean isHeld(Integer button){
return clickMap.getOrDefault(button,false);
}
//0=Left click, 1=Right click, 2=Middle, 3=Button 4, 4=Button 5
public static boolean isPressed(Integer button){
return pressMap.getOrDefault(button,false);
}
//0=Left click, 1=Right click, 2=Middle, 3=Button 4, 4=Button 5
public static boolean isReleased(Integer button){
return releaseMap.getOrDefault(button,false);
}
}