2 using Microsoft.Xna.Framework;
3 using Microsoft.Xna.Framework.Graphics;
6 namespace Loot.Api.Graphics.Glowmask
17 public bool DrawHitbox {
get;
set; }
18 public Texture2D GlowmaskTexture {
get;
protected set; }
20 public GlowmaskEntity(
object subjectIdentity,
bool drawHitbox =
false,
short order = 0, Color? drawColor = null,
22 : base(subjectIdentity)
24 DrawHitbox = drawHitbox;
26 DrawColor = drawColor ?? Color.White;
32 if (GlowmaskTexture != null)
return;
35 GlowmaskTexture = graphicsContent?.GetPreparedGlowmask(item.type.ToString()) ?? Main.itemTexture[item.type];
41 public void DoDrawGlowmask(SpriteBatch spriteBatch, Color lightColor, Color alphaColor,
float rotation,
float scale,
int whoAmI, Texture2D suppliedGlowmask = null)
43 if (!Properties.SkipDrawing || !Properties.SkipDrawingGlowmask)
return;
45 TryGettingDrawData(rotation, scale);
46 if (Entity is Item item) LoadAssets(item);
47 else Loot.Logger.Warn(
"Could not identify shader entity identity as item");
48 Texture2D useGlowmaskTexture = suppliedGlowmask ?? GlowmaskTexture;
50 if (useGlowmaskTexture != null)
52 var drawDataTexture = DrawData.texture;
53 var drawDataColor = DrawData.color;
54 var drawDataDestinationRectangle = DrawData.destinationRectangle;
55 DrawData.texture = useGlowmaskTexture;
56 DrawData.color = lightColor;
57 TryUpdatingDrawData(useGlowmaskTexture);
58 DrawEntity(spriteBatch);
59 DrawData.texture = drawDataTexture;
60 DrawData.color = drawDataColor;
61 DrawData.destinationRectangle = drawDataDestinationRectangle;
64 Properties.SkipUpdatingDrawData =
false;
72 if (!DrawHitbox)
return;
73 Rectangle hitbox = Entity.Hitbox;
74 hitbox.Offset((
int)-Main.screenPosition.X, (
int)-Main.screenPosition.Y);
75 spriteBatch.Draw(Main.magicPixel, hitbox, Color.White);
void DoDrawGlowmask(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI, Texture2D suppliedGlowmask=null)
Will draw the glowmask texture
Defines the GraphicsProperties for GlowmaskEntitys which derives from GraphicsProperties ...
static new GlowmaskGraphicsPropertiesBuilder Builder
GlowmaskEntity(object subjectIdentity, bool drawHitbox=false, short order=0, Color?drawColor=null, GlowmaskGraphicsProperties props=null)
Defines the base abstract of a GraphicsEntity
void DoDrawHitbox(SpriteBatch spriteBatch)
Will draw the hitbox around the entity
Defines a Glowmask entity, part of GraphicsEntity The entity defines a particular 'glowmask' "of" the...
This class stores glowmask and shader textures that can be looked up during drawing ...
override void LoadAssets(Item item)