mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-24 01:35:38 +07:00
Closes Anuken/Mindustry-Suggestions/issues/5012
This commit is contained in:
parent
a0569a63bc
commit
f30b24f4ac
@ -3,9 +3,11 @@ package mindustry.ui;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.input.*;
|
import arc.input.*;
|
||||||
|
import arc.math.*;
|
||||||
import arc.scene.*;
|
import arc.scene.*;
|
||||||
import arc.scene.event.*;
|
import arc.scene.event.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@ -20,6 +22,22 @@ public class Minimap extends Table{
|
|||||||
add(new Element(){
|
add(new Element(){
|
||||||
{
|
{
|
||||||
setSize(Scl.scl(140f));
|
setSize(Scl.scl(140f));
|
||||||
|
|
||||||
|
addListener(new ClickListener(KeyCode.mouseRight){
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float cx, float cy){
|
||||||
|
var region = renderer.minimap.getRegion();
|
||||||
|
if(region == null) return;
|
||||||
|
|
||||||
|
float
|
||||||
|
sx = (cx - x) / width,
|
||||||
|
sy = (cy - y) / height,
|
||||||
|
scaledX = Mathf.lerp(region.u, region.u2, sx) * world.width() * tilesize,
|
||||||
|
scaledY = Mathf.lerp(1f - region.v2, 1f - region.v, sy) * world.height() * tilesize;
|
||||||
|
|
||||||
|
control.input.panCamera(Tmp.v1.set(scaledX, scaledY));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user