mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-15 15:20:57 -08:00
Allow markers to use any texture (#9455)
This commit is contained in:
parent
46fa57bb3b
commit
7440f195ba
2 changed files with 18 additions and 9 deletions
|
|
@ -163,3 +163,4 @@ Yoru Kitsune
|
|||
summoner
|
||||
OpalSoPL
|
||||
BalaM314
|
||||
Redstonneur1256
|
||||
|
|
|
|||
|
|
@ -1156,27 +1156,35 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
|||
public void baseDraw(float x, float y, float scaleFactor){
|
||||
if(textureName.isEmpty()) return;
|
||||
|
||||
if(fetchedRegion == null) fetchedRegion = Core.atlas.find(textureName);
|
||||
if(fetchedRegion == null) setTexture(textureName);
|
||||
|
||||
// Zero width/height scales marker to original texture's size
|
||||
if(Mathf.equal(width, 0f)) width = fetchedRegion.width * fetchedRegion.scl() * Draw.xscl;
|
||||
if(Mathf.equal(height, 0f)) height = fetchedRegion.height * fetchedRegion.scl() * Draw.yscl;
|
||||
|
||||
Draw.z(drawLayer);
|
||||
if(fetchedRegion.found()){
|
||||
Draw.color(color);
|
||||
Draw.rect(fetchedRegion, x, y, width * scaleFactor, height * scaleFactor, rotation);
|
||||
}else{
|
||||
Draw.color(Color.white);
|
||||
Draw.rect("error", x, y, width * scaleFactor, height * scaleFactor, rotation);
|
||||
}
|
||||
Draw.color(color);
|
||||
Draw.rect(fetchedRegion, x, y, width * scaleFactor, height * scaleFactor, rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture(String textureName){
|
||||
this.textureName = textureName;
|
||||
fetchedRegion = Core.atlas.find(textureName);
|
||||
|
||||
if(fetchedRegion == null) fetchedRegion = new TextureRegion();
|
||||
|
||||
TextureRegion region = Core.atlas.find(textureName);
|
||||
if(region.found()){
|
||||
fetchedRegion.set(region);
|
||||
}else{
|
||||
if(Core.assets.isLoaded(textureName, Texture.class)){
|
||||
fetchedRegion.set(Core.assets.get(textureName, Texture.class));
|
||||
}else{
|
||||
fetchedRegion.set(Core.atlas.find("error"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** For arrays or {@link Seq}s; does not create element rearrangement buttons. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue