Removed all tmps, multithreading now functional
This commit is contained in:
@@ -23,7 +23,6 @@ import io.anuke.ucore.core.Sounds;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.SolidEntity;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Tmp;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -36,6 +35,8 @@ public abstract class InputHandler extends InputAdapter{
|
||||
public PlaceMode lastPlaceMode = placeMode;
|
||||
public PlaceMode lastBreakMode = breakMode;
|
||||
|
||||
private Rectangle rect = new Rectangle();
|
||||
|
||||
public abstract void update();
|
||||
public abstract float getCursorX();
|
||||
public abstract float getCursorY();
|
||||
@@ -93,21 +94,21 @@ public abstract class InputHandler extends InputAdapter{
|
||||
}
|
||||
}
|
||||
|
||||
Tmp.r2.setSize(type.width * tilesize, type.height * tilesize);
|
||||
rect.setSize(type.width * tilesize, type.height * tilesize);
|
||||
Vector2 offset = type.getPlaceOffset();
|
||||
Tmp.r2.setCenter(offset.x + x * tilesize, offset.y + y * tilesize);
|
||||
rect.setCenter(offset.x + x * tilesize, offset.y + y * tilesize);
|
||||
|
||||
for(SolidEntity e : Entities.getNearby(enemyGroup, x * tilesize, y * tilesize, tilesize * 2f)){
|
||||
Rectangle rect = e.hitbox.getRect(e.x, e.y);
|
||||
|
||||
if(Tmp.r2.overlaps(rect)){
|
||||
if(this.rect.overlaps(rect)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(type.solid || type.solidifes) {
|
||||
for (Player player : playerGroup.all()) {
|
||||
if (!player.isAndroid && Tmp.r2.overlaps(player.hitbox.getRect(player.x, player.y))) {
|
||||
if (!player.isAndroid && rect.overlaps(player.hitbox.getRect(player.x, player.y))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Tmp;
|
||||
import io.anuke.ucore.util.Translator;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -44,8 +44,8 @@ public enum PlaceMode{
|
||||
|
||||
if(control.input().recipe.result.rotate){
|
||||
Draw.color(Colors.get("placeRotate"));
|
||||
Tmp.v1.set(7, 0).rotate(control.input().rotation * 90);
|
||||
Lines.line(x, y, x + Tmp.v1.x, y + Tmp.v1.y);
|
||||
tr.trns(control.input().rotation * 90, 7, 0);
|
||||
Lines.line(x, y, x + tr.x, y + tr.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,8 +293,8 @@ public enum PlaceMode{
|
||||
if(control.input().recipe.result.rotate){
|
||||
float cx = tx * t, cy = ty * t;
|
||||
Draw.color(Colors.get("placeRotate"));
|
||||
Tmp.v1.set(7, 0).rotate(rotation * 90);
|
||||
Lines.line(cx, cy, cx + Tmp.v1.x, cy + Tmp.v1.y);
|
||||
tr.trns(rotation * 90, 7, 0);
|
||||
Lines.line(cx, cy, cx + tr.x, cy + tr.y);
|
||||
}
|
||||
Draw.reset();
|
||||
}
|
||||
@@ -368,6 +368,8 @@ public enum PlaceMode{
|
||||
public boolean showCancel;
|
||||
public boolean delete = false;
|
||||
public boolean both = false;
|
||||
|
||||
private static final Translator tr = new Translator();
|
||||
|
||||
public void draw(int tilex, int tiley, int endx, int endy){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user