void update_rightclickselection() { if (Center.rightMouseDown()) { if (!checkMouseOver()) return; if (Center.rightMouseClicked()) { Vector2 mousepos = screenToMap(Center.mousePosition()); rightclickdragstartposition = mousepos; float dist = 99999; ArrayList<EventLocation> selectedlocations = new ArrayList<EventLocation>(); for (EventLocation location : spawns) { float d = Vector2.distance(mousepos, location.position); if (d == dist) { selectedlocations.add(location); } else if (d < dist) { selectedlocations.clear(); dist = d; selectedlocations.add(location); } } if (!Center.getKey(Keys.SHIFT) && !Center.getKey(Keys.CONTROL)) SpawnList.clearSelections(); for (EventLocation location : selectedlocations) { SpawnList.instance.selectedSpawns.add(location); SpawnList.instance.focusOnBar(spawns.indexOf(location)); } } if (rightclickdragstartposition == null) return; Vector2 mousepos = screenToMap(Center.mousePosition()); if (!Vector2.distanceLessThan(rightclickdragstartposition, mousepos, .1f)) { Vector2 pos0 = new Vector2( mousepos.x < rightclickdragstartposition.x ? mousepos.x : rightclickdragstartposition.x, mousepos.y < rightclickdragstartposition.y ? mousepos.y : rightclickdragstartposition.y); Vector2 pos1 = new Vector2( mousepos.x > rightclickdragstartposition.x ? mousepos.x : rightclickdragstartposition.x, mousepos.y > rightclickdragstartposition.y ? mousepos.y : rightclickdragstartposition.y); if (!Center.getKey(Keys.SHIFT) && !Center.getKey(Keys.CONTROL)) SpawnList.clearSelections(); for (EventLocation location : spawns) { if (location.position.x > pos0.x && location.position.y > pos0.y && location.position.x < pos1.x && location.position.y < pos1.y) SpawnList.selectedSpawns.add(location); } } } else rightclickdragstartposition = null; }
public boolean shouldBeDepressed() { return super.shouldBeDepressed() || Center.getKey(Keys.R); }
public boolean checkMouseClicked() { return super.checkMouseClicked() || Center.getKey(Keys.R); }