/** Rendering and interface methods- */ public void renderFor(Rendering rendering) { final Viewport port = rendering.port; for (Mission mission : missions) { final Sprite flag = mission.flagSprite(); if (!port.intersects(flag.position, 2)) continue; rendering.addClient(flag); } }
public Mission pickedMission(BaseUI UI, Viewport port) { Mission closest = null; float minDist = Float.POSITIVE_INFINITY; for (Mission mission : missions) { final Sprite flag = mission.flagSprite(); float dist = port.isoToScreen(new Vec3D().setTo(flag.position)).z; if (port.mouseIntersects(flag.position, 0.5f, UI)) { if (dist < minDist) { minDist = dist; closest = mission; } } } return closest; }