Minimap fixes

This commit is contained in:
Anuken 2019-04-04 23:34:09 -04:00
parent 812dea385c
commit 45d157fe3f
5 changed files with 16 additions and 27 deletions

View File

@ -195,7 +195,7 @@ editor.description = Description:
editor.waves = Vagues:
waves.title = Vagues
waves.remove = Remove
waves.never = <jamais>
waves.never = jamais
waves.every = tous les
waves.waves = vague(s)
waves.perspawn = par apparition

View File

@ -1510,8 +1510,8 @@ public class Blocks implements ContentList{
powerUsed = 0.5f;
consumes.powerBuffered(1200f);
range = 190f;
reload = 170f;
firingMoveFract = 0.2f;
reload = 50f;
firingMoveFract = 0.5f;
shootDuration = 220f;
health = 200 * size * size;

View File

@ -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[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};

View File

@ -9,13 +9,12 @@ import io.anuke.arc.graphics.Pixmaps;
import io.anuke.arc.graphics.Texture;
import io.anuke.arc.graphics.g2d.Draw;
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.math.Mathf;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.util.Disposable;
import io.anuke.mindustry.entities.type.Unit;
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.WorldLoadEvent;
import io.anuke.mindustry.io.MapIO;
@ -49,7 +48,11 @@ public class MinimapRenderer implements Disposable{
public void zoomBy(float 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(){
@ -75,21 +78,15 @@ public class MinimapRenderer implements Disposable{
dx = Mathf.clamp(dx, sz, world.width() - 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);
for(Unit unit : units){
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
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();
ScissorStack.popScissors();
}
public TextureRegion getRegion(){

View File

@ -48,24 +48,11 @@ public class Minimap extends Container<Element>{
margin(margin);
addListener(new InputListener(){
@Override
public boolean scrolled(InputEvent event, float x, float y, float amountx, float amounty){
renderer.minimap.zoomBy(amounty);
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(){
@ -91,6 +78,11 @@ public class Minimap extends Container<Element>{
invalidateTapSquare();
}
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