Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetClippingRectangle()

Rectangle Terraria.UI.UIElement.GetClippingRectangle ( SpriteBatch spriteBatch)
inlineinherited

Definition at line 246 of file UIElement.cs.

247 {
250 vector = Vector2.Transform(vector, Main.UIScaleMatrix);
251 position = Vector2.Transform(position, Main.UIScaleMatrix);
252 Rectangle rectangle = new Rectangle((int)vector.X, (int)vector.Y, (int)(position.X - vector.X), (int)(position.Y - vector.Y));
253 int num = (int)((float)Main.screenWidth * Main.UIScale);
254 int num2 = (int)((float)Main.screenHeight * Main.UIScale);
255 rectangle.X = Utils.Clamp(rectangle.X, 0, num);
256 rectangle.Y = Utils.Clamp(rectangle.Y, 0, num2);
257 rectangle.Width = Utils.Clamp(rectangle.Width, 0, num - rectangle.X);
258 rectangle.Height = Utils.Clamp(rectangle.Height, 0, num2 - rectangle.Y);
259 Rectangle scissorRectangle = spriteBatch.GraphicsDevice.ScissorRectangle;
260 int num3 = Utils.Clamp(rectangle.Left, scissorRectangle.Left, scissorRectangle.Right);
261 int num4 = Utils.Clamp(rectangle.Top, scissorRectangle.Top, scissorRectangle.Bottom);
262 int num5 = Utils.Clamp(rectangle.Right, scissorRectangle.Left, scissorRectangle.Right);
263 int num6 = Utils.Clamp(rectangle.Bottom, scissorRectangle.Top, scissorRectangle.Bottom);
264 return new Rectangle(num3, num4, num5 - num3, num6 - num4);
265 }
CalculatedStyle _innerDimensions
Definition UIElement.cs:67
static Vector2 Transform(Vector2 position, Matrix matrix)
Definition Vector2.cs:317

References Terraria.UI.UIElement._innerDimensions, Microsoft.Xna.Framework.Rectangle.Bottom, Microsoft.Xna.Framework.Graphics.GraphicsResource.GraphicsDevice, Terraria.UI.CalculatedStyle.Height, Microsoft.Xna.Framework.Rectangle.Left, Microsoft.Xna.Framework.Rectangle.Right, Microsoft.Xna.Framework.Graphics.GraphicsDevice.ScissorRectangle, Microsoft.Xna.Framework.Rectangle.Top, Microsoft.Xna.Framework.Vector2.Transform(), Terraria.Main.UIScale, Terraria.Main.UIScaleMatrix, Microsoft.Xna.Framework.Graphics.Vector2, Terraria.UI.CalculatedStyle.Width, Microsoft.Xna.Framework.Vector2.X, Terraria.UI.CalculatedStyle.X, Microsoft.Xna.Framework.Vector2.Y, and Terraria.UI.CalculatedStyle.Y.

Referenced by Terraria.GameContent.UI.States.UIGamepadHelper.CullPointsOutOfElementArea(), Terraria.UI.UIElement.Draw(), Terraria.GameContent.UI.States.UIEmotesMenu.RemoveSnapPointsOutOfScreen(), Terraria.GameContent.UI.States.UICharacterSelect.SetupGamepadPoints(), Terraria.GameContent.UI.States.UIEmotesMenu.SetupGamepadPoints(), Terraria.GameContent.UI.States.UIManageControls.SetupGamepadPoints(), Terraria.GameContent.UI.States.UIWorkshopSelectResourcePackToPublish.SetupGamepadPoints(), Terraria.GameContent.UI.States.UIWorkshopSelectWorldToPublish.SetupGamepadPoints(), Terraria.GameContent.UI.States.UIWorkshopWorldImport.SetupGamepadPoints(), and Terraria.GameContent.UI.States.UIWorldSelect.SetupGamepadPoints().