Arc compatibility update

This commit is contained in:
Anuken
2018-12-27 15:47:17 -05:00
parent 3b42b604e1
commit db546412f1
75 changed files with 255 additions and 285 deletions

View File

@@ -1,6 +1,5 @@
package io.anuke.mindustry.graphics;
import io.anuke.arc.Core;
import io.anuke.arc.Events;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.IntSet;
@@ -58,7 +57,7 @@ public class BlockRenderer{
public void drawShadows(){
Draw.color(0, 0, 0, 0.15f);
Draw.rect().tex(shadows.getTexture()).center(
Draw.rect(Draw.wrap(shadows.getTexture()),
camera.position.x - camera.position.x % tilesize,
camera.position.y - camera.position.y % tilesize,
shadows.getWidth(), -shadows.getHeight());
@@ -90,7 +89,7 @@ public class BlockRenderer{
requestidx = 0;
Draw.flush();
Core.graphics.batch().getProjection()
Draw.proj()
.setOrtho(Mathf.round(camera.position.x, tilesize)-shadowW/2f, Mathf.round(camera.position.y, tilesize)-shadowH/2f,
shadowW, shadowH);
@@ -141,7 +140,7 @@ public class BlockRenderer{
shadows.end();
Draw.flush();
Draw.projection(camera.projection());
Draw.proj(camera.projection());
Sort.instance().sort(requests.items, 0, requestidx);

View File

@@ -7,11 +7,9 @@ import io.anuke.arc.collection.IntSet;
import io.anuke.arc.collection.IntSet.IntSetIterator;
import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.graphics.Camera;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.GL20;
import io.anuke.arc.graphics.g2d.CacheBatch;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.SpriteBatch;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Log;
@@ -145,12 +143,6 @@ public class FloorRenderer{
layer.end();
}
private void fillChunk(float x, float y){
Draw.color(Color.BLACK);
Fill.rect().set(x, y, chunksize * tilesize, chunksize * tilesize);
Draw.color();
}
private void cacheChunk(int cx, int cy){
Chunk chunk = cache[cx][cy];
@@ -174,8 +166,10 @@ public class FloorRenderer{
}
private void cacheChunkLayer(int cx, int cy, Chunk chunk, CacheLayer layer){
SpriteBatch current = Core.graphics.batch();
Core.graphics.useBatch(cbatch);
SpriteBatch current = Core.batch;
Core.batch = cbatch;
cbatch.beginCache();
for(int tilex = cx * chunksize; tilex < (cx + 1) * chunksize; tilex++){
for(int tiley = cy * chunksize; tiley < (cy + 1) * chunksize; tiley++){
@@ -195,8 +189,8 @@ public class FloorRenderer{
}
}
}
Core.graphics.useBatch(current);
chunk.caches[layer.ordinal()] = cbatch.flushCache();
Core.batch = current;
chunk.caches[layer.ordinal()] = cbatch.endCache();
}
public void clearTiles(){

View File

@@ -8,6 +8,7 @@ import io.anuke.arc.graphics.Pixmap.Format;
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;
@@ -81,7 +82,7 @@ public class MinimapRenderer implements Disposable{
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);
Draw.rect().tex(Core.atlas.white()).set(x + rx, y + ry, w / (sz * 2), h / (sz * 2));
Fill.crect(x + rx, y + ry, w / (sz * 2), h / (sz * 2));
}
Draw.color();

View File

@@ -26,14 +26,13 @@ public class Shapes{
TextureRegion region = Core.atlas.find(edge);
Draw.rect(edge, x, y, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl).rot(rotation + 180);
Draw.rect(Core.atlas.find(edge), x, y, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl, rotation + 180);
Draw.rect(edge, x2, y2, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl).rot(rotation);
Draw.rect(Core.atlas.find(edge), x2, y2, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl, rotation);
}
public static void tri(float x, float y, float width, float length, float rotation){
float oy = 17f / 63f * length;
Core.graphics.batch().draw().tex(Core.atlas.find("shape-3")).pos(x - width / 2f, y - oy)
.origin(width / 2f, oy).size(width, length).rot(rotation - 90);
Draw.rect(Core.atlas.find("shape-3"), x, y - oy + length/2f, width, length, width / 2f, oy, rotation - 90);
}
}