mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-22 02:07:20 +07:00
Merge pull request #2093 from zethnest/map-center
[QOL] Center Map to Player Implementation
This commit is contained in:
commit
23e1d0998a
@ -647,6 +647,7 @@ setting.linear.name = Linear Filtering
|
||||
setting.hints.name = Hints
|
||||
setting.flow.name = Display Resource Flow Rate
|
||||
setting.buildautopause.name = Auto-Pause Building
|
||||
setting.mapcenter.name = Auto Center Map To Player
|
||||
setting.animatedwater.name = Animated Fluids
|
||||
setting.animatedshields.name = Animated Shields
|
||||
setting.antialias.name = Antialias[lightgray] (requires restart)[]
|
||||
|
@ -242,6 +242,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
if(!mobile){
|
||||
game.checkPref("buildautopause", false);
|
||||
}
|
||||
game.checkPref("mapcenter", true);
|
||||
|
||||
if(steam){
|
||||
game.sliderPref("playerlimit", 16, 2, 32, i -> {
|
||||
|
@ -111,6 +111,12 @@ public class MinimapFragment extends Fragment{
|
||||
}
|
||||
|
||||
public void toggle(){
|
||||
if(Core.settings.getBool("mapcenter")){
|
||||
float size = baseSize * zoom * world.width();
|
||||
float ratio = (float)renderer.minimap.getTexture().getHeight() / renderer.minimap.getTexture().getWidth();
|
||||
panx = (size/2f - player.x() / (world.width() * tilesize) * size) / zoom;
|
||||
pany = (size*ratio/2f - player.y() / (world.height() * tilesize) * size*ratio) / zoom;
|
||||
}
|
||||
shown = !shown;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user