2 using Microsoft.Xna.Framework;
3 using Microsoft.Xna.Framework.Graphics;
12 public Action<SpriteBatch, GUICustomComponent>
OnDraw;
13 public Action<float, GUICustomComponent>
OnUpdate;
17 public GUICustomComponent(
RectTransform rectT, Action<SpriteBatch, GUICustomComponent> onDraw =
null, Action<float, GUICustomComponent> onUpdate =
null) : base(null, rectT)
23 protected override void Draw(SpriteBatch spriteBatch)
27 Rectangle prevScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;
31 spriteBatch.GraphicsDevice.ScissorRectangle =
Rectangle.Intersect(prevScissorRect,
Rect);
35 OnDraw?.Invoke(spriteBatch,
this);
40 spriteBatch.GraphicsDevice.ScissorRectangle = prevScissorRect;
45 protected override void Update(
float deltaTime)
GUIComponent that can be used to render custom content on the UI
Action< float, GUICustomComponent > OnUpdate
bool HideElementsOutsideFrame
GUICustomComponent(RectTransform rectT, Action< SpriteBatch, GUICustomComponent > onDraw=null, Action< float, GUICustomComponent > onUpdate=null)
override void Update(float deltaTime)
Action< SpriteBatch, GUICustomComponent > OnDraw
override void Draw(SpriteBatch spriteBatch)
static RasterizerState ScissorTestEnable