Added Android automatic shooting
This commit is contained in:
@@ -31,7 +31,7 @@ public class OverlayRenderer {
|
||||
Shaders.outline.color.set(Palette.accent);
|
||||
Graphics.beginShaders(Shaders.outline);
|
||||
|
||||
input.drawBottom();
|
||||
input.drawOutlined();
|
||||
|
||||
Graphics.endShaders();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package io.anuke.mindustry.graphics;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.FloatArray;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
/**Class that renders a trail.*/
|
||||
public class Trail {
|
||||
private final int length;
|
||||
|
||||
private FloatArray points = new FloatArray();
|
||||
|
||||
public Trail(int length){
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public void update(float curx, float cury){
|
||||
points.add(curx, cury);
|
||||
|
||||
if(points.size > length*2) {
|
||||
float[] items = points.items;
|
||||
System.arraycopy(items, 2, items, 0, points.size - 2);
|
||||
points.size -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Color start, Color end, float stroke){
|
||||
|
||||
for(int i = 0; i < points.size - 2; i += 2){
|
||||
float x = points.get(i);
|
||||
float y = points.get(i + 1);
|
||||
float x2 = points.get(i + 2);
|
||||
float y2 = points.get(i + 3);
|
||||
float s = Mathf.clamp((float)(i) / points.size);
|
||||
|
||||
Draw.color(start, end, s);
|
||||
|
||||
Lines.stroke(s * stroke);
|
||||
Lines.line(x, y, x2, y2);
|
||||
}
|
||||
|
||||
if(points.size >= 2){
|
||||
Fill.circle(points.get(points.size-2), points.get(points.size-1), stroke/2f);
|
||||
}
|
||||
|
||||
Draw.color(start);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user