package game; public enum Button implements Input { MOUSE_LEFT("lmb", "Linke Maustaste"), MOUSE_RIGHT("rmb", "Rechte Maustaste"), MOUSE_MIDDLE("mmb", "Mittlere Maustaste"), MOUSE_BTN_X("xmb", "Maustaste Seite 1"), MOUSE_BTN_Y("ymb", "Maustaste Seite 2"), MOUSE_BTN_A("m6", "Maustaste 6"), MOUSE_BTN_B("m7", "Maustaste 7"), MOUSE_BTN_C("m8", "Maustaste 8"); private static int buttons; private final String id; private final String name; private boolean down; public static boolean isMouseDown() { return buttons != 0; } private Button(String id, String name) { this.id = id; this.name = name; } public String getName() { return this.id; } public String getDisplay() { return this.name; } public boolean read() { return Game.getGame().open == null && this.down; } public void setDown(boolean down) { this.down = down; buttons = (buttons & ~(1 << this.ordinal())) | (down ? 1 << this.ordinal() : 0); } public boolean isDown() { return this.down; } }