Minimap attack indicators

This commit is contained in:
Anuken
2023-04-15 15:54:33 -04:00
parent 4ae8a51676
commit e47806b9b8
4 changed files with 116 additions and 3 deletions

View File

@@ -86,15 +86,16 @@ public class MinimapFragment{
panx += deltaX / zoom;
pany += deltaY / zoom;
}else{
Rect r = getRectBounds();
Tmp.v1.set(x, y).sub(r.x, r.y).scl(1f / r.width, 1f / r.height).scl(world.unitWidth(), world.unitHeight());
control.input.panCamera(Tmp.v1);
panTo(x, y);
}
}
@Override
public void touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
super.touchDown(event, x, y, pointer, button);
if(button == KeyCode.mouseRight){
panTo(x, y);
}
}
@Override
@@ -125,6 +126,12 @@ public class MinimapFragment{
});
}
public void panTo(float relativeX, float relativeY){
Rect r = getRectBounds();
Tmp.v1.set(relativeX, relativeY).sub(r.x, r.y).scl(1f / r.width, 1f / r.height).scl(world.unitWidth(), world.unitHeight());
control.input.panCamera(Tmp.v1);
}
public boolean shown(){
return shown;
}