Allow markers to use any texture (#9455)
This commit is contained in:
@@ -163,3 +163,4 @@ Yoru Kitsune
|
|||||||
summoner
|
summoner
|
||||||
OpalSoPL
|
OpalSoPL
|
||||||
BalaM314
|
BalaM314
|
||||||
|
Redstonneur1256
|
||||||
|
|||||||
@@ -1156,27 +1156,35 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
|||||||
public void baseDraw(float x, float y, float scaleFactor){
|
public void baseDraw(float x, float y, float scaleFactor){
|
||||||
if(textureName.isEmpty()) return;
|
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
|
// 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(width, 0f)) width = fetchedRegion.width * fetchedRegion.scl() * Draw.xscl;
|
||||||
if(Mathf.equal(height, 0f)) height = fetchedRegion.height * fetchedRegion.scl() * Draw.yscl;
|
if(Mathf.equal(height, 0f)) height = fetchedRegion.height * fetchedRegion.scl() * Draw.yscl;
|
||||||
|
|
||||||
Draw.z(drawLayer);
|
Draw.z(drawLayer);
|
||||||
if(fetchedRegion.found()){
|
Draw.color(color);
|
||||||
Draw.color(color);
|
Draw.rect(fetchedRegion, x, y, width * scaleFactor, height * scaleFactor, rotation);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTexture(String textureName){
|
public void setTexture(String textureName){
|
||||||
this.textureName = 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. */
|
/** For arrays or {@link Seq}s; does not create element rearrangement buttons. */
|
||||||
|
|||||||
Reference in New Issue
Block a user