mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Minimap fixes
This commit is contained in:
parent
812dea385c
commit
45d157fe3f
@ -195,7 +195,7 @@ editor.description = Description:
|
|||||||
editor.waves = Vagues:
|
editor.waves = Vagues:
|
||||||
waves.title = Vagues
|
waves.title = Vagues
|
||||||
waves.remove = Remove
|
waves.remove = Remove
|
||||||
waves.never = <jamais>
|
waves.never = jamais
|
||||||
waves.every = tous les
|
waves.every = tous les
|
||||||
waves.waves = vague(s)
|
waves.waves = vague(s)
|
||||||
waves.perspawn = par apparition
|
waves.perspawn = par apparition
|
||||||
|
@ -1510,8 +1510,8 @@ public class Blocks implements ContentList{
|
|||||||
powerUsed = 0.5f;
|
powerUsed = 0.5f;
|
||||||
consumes.powerBuffered(1200f);
|
consumes.powerBuffered(1200f);
|
||||||
range = 190f;
|
range = 190f;
|
||||||
reload = 170f;
|
reload = 50f;
|
||||||
firingMoveFract = 0.2f;
|
firingMoveFract = 0.5f;
|
||||||
shootDuration = 220f;
|
shootDuration = 220f;
|
||||||
|
|
||||||
health = 200 * size * size;
|
health = 200 * size * size;
|
||||||
|
@ -533,7 +533,7 @@ public class Bullets implements ContentList{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
meltdownLaser = new BulletType(0.001f, 50){
|
meltdownLaser = new BulletType(0.001f, 70){
|
||||||
Color tmpColor = new Color();
|
Color tmpColor = new Color();
|
||||||
Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
|
Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
|
||||||
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
||||||
|
@ -9,13 +9,12 @@ import io.anuke.arc.graphics.Pixmaps;
|
|||||||
import io.anuke.arc.graphics.Texture;
|
import io.anuke.arc.graphics.Texture;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.g2d.Fill;
|
import io.anuke.arc.graphics.g2d.Fill;
|
||||||
import io.anuke.arc.graphics.g2d.ScissorStack;
|
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.geom.Rectangle;
|
import io.anuke.arc.math.geom.Rectangle;
|
||||||
import io.anuke.arc.util.Disposable;
|
import io.anuke.arc.util.Disposable;
|
||||||
import io.anuke.mindustry.entities.type.Unit;
|
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
|
import io.anuke.mindustry.entities.type.Unit;
|
||||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||||
import io.anuke.mindustry.io.MapIO;
|
import io.anuke.mindustry.io.MapIO;
|
||||||
@ -49,7 +48,11 @@ public class MinimapRenderer implements Disposable{
|
|||||||
|
|
||||||
public void zoomBy(float amount){
|
public void zoomBy(float amount){
|
||||||
zoom += amount;
|
zoom += amount;
|
||||||
zoom = Mathf.clamp(zoom, 1f, Math.min(world.width(), world.height()) / baseSize / 2f);
|
setZoom(zoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoom(float amount){
|
||||||
|
zoom = Mathf.clamp(amount, 1f, Math.min(world.width(), world.height()) / baseSize / 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getZoom(){
|
public float getZoom(){
|
||||||
@ -75,21 +78,15 @@ public class MinimapRenderer implements Disposable{
|
|||||||
dx = Mathf.clamp(dx, sz, world.width() - sz);
|
dx = Mathf.clamp(dx, sz, world.width() - sz);
|
||||||
dy = Mathf.clamp(dy, sz, world.height() - sz);
|
dy = Mathf.clamp(dy, sz, world.height() - sz);
|
||||||
|
|
||||||
if(!ScissorStack.pushScissors(scissor.set(x, y, w, h))){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.set((dx - sz) * tilesize, (dy - sz) * tilesize, sz * 2 * tilesize, sz * 2 * tilesize);
|
rect.set((dx - sz) * tilesize, (dy - sz) * tilesize, sz * 2 * tilesize, sz * 2 * tilesize);
|
||||||
|
|
||||||
for(Unit unit : units){
|
for(Unit unit : units){
|
||||||
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
|
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
|
||||||
Draw.color(unit.getTeam().color);
|
Draw.color(unit.getTeam().color);
|
||||||
Fill.crect(x + rx, y + ry, w / (sz * 2), h / (sz * 2));
|
Fill.rect(x + rx, y + ry, baseSize/2f, baseSize/2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
ScissorStack.popScissors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextureRegion getRegion(){
|
public TextureRegion getRegion(){
|
||||||
|
@ -48,24 +48,11 @@ public class Minimap extends Container<Element>{
|
|||||||
margin(margin);
|
margin(margin);
|
||||||
|
|
||||||
addListener(new InputListener(){
|
addListener(new InputListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean scrolled(InputEvent event, float x, float y, float amountx, float amounty){
|
public boolean scrolled(InputEvent event, float x, float y, float amountx, float amounty){
|
||||||
renderer.minimap.zoomBy(amounty);
|
renderer.minimap.zoomBy(amounty);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void touchDragged(InputEvent event, float x, float y, int pointer){
|
|
||||||
if(mobile){
|
|
||||||
renderer.minimap.zoomBy(Core.input.deltaY(pointer) / 12f / Unit.dp.scl(1f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
addListener(new ClickListener(){
|
addListener(new ClickListener(){
|
||||||
@ -91,6 +78,11 @@ public class Minimap extends Container<Element>{
|
|||||||
invalidateTapSquare();
|
invalidateTapSquare();
|
||||||
}
|
}
|
||||||
super.touchDragged(event, x, y, pointer);
|
super.touchDragged(event, x, y, pointer);
|
||||||
|
|
||||||
|
//if(mobile){
|
||||||
|
float max = Math.min(world.width(), world.height()) / 16f / 2f;
|
||||||
|
renderer.minimap.setZoom(1f + y / height * (max - 1f));
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user