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

◆ DrawCursorSingle()

static void Terraria.Utils.DrawCursorSingle ( SpriteBatch sb,
Color color,
float rot = float::NaN,
float scale = 1f,
Vector2 manualPosition = default(Vector2),
int cursorSlot = 0,
int specialMode = 0 )
inlinestatic

Definition at line 2111 of file Utils.cs.

2112 {
2113 bool flag = false;
2114 bool flag2 = true;
2115 bool flag3 = true;
2116 Vector2 origin = Vector2.Zero;
2117 Vector2 vector = new Vector2(Main.mouseX, Main.mouseY);
2119 {
2121 }
2122 if (float.IsNaN(rot))
2123 {
2124 rot = 0f;
2125 }
2126 else
2127 {
2128 flag = true;
2129 rot -= (float)Math.PI * 3f / 4f;
2130 }
2131 if (cursorSlot == 4 || cursorSlot == 5)
2132 {
2133 flag2 = false;
2134 origin = new Vector2(8f);
2135 if (flag && specialMode == 0)
2136 {
2137 float num = rot;
2138 if (num < 0f)
2139 {
2140 num += (float)Math.PI * 2f;
2141 }
2142 for (float num2 = 0f; num2 < 4f; num2 += 1f)
2143 {
2144 if (Math.Abs(num - (float)Math.PI / 2f * num2) <= (float)Math.PI / 4f)
2145 {
2146 rot = (float)Math.PI / 2f * num2;
2147 break;
2148 }
2149 }
2150 }
2151 }
2153 if ((Main.ThickMouse && cursorSlot == 0) || cursorSlot == 1)
2154 {
2155 vector2 = Main.DrawThickCursor(cursorSlot == 1);
2156 }
2157 if (flag2)
2158 {
2159 sb.Draw(TextureAssets.Cursors[cursorSlot].Value, vector + vector2 + Vector2.One, null, color.MultiplyRGB(new Color(0.2f, 0.2f, 0.2f, 0.5f)), rot, origin, scale * 1.1f, SpriteEffects.None, 0f);
2160 }
2161 if (flag3)
2162 {
2163 sb.Draw(TextureAssets.Cursors[cursorSlot].Value, vector + vector2, null, color, rot, origin, scale, SpriteEffects.None, 0f);
2164 }
2165 }
void Draw(Texture2D texture, Vector2 position, Color color)
static double Abs(double value)
const double PI
Definition Math.cs:16
static Asset< Texture2D >[] Cursors

References System.Math.Abs(), Terraria.GameContent.TextureAssets.Cursors, Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.Main.DrawThickCursor(), Terraria.Main.mouseX, Terraria.Main.mouseY, Microsoft.Xna.Framework.Vector2.One, System.Math.PI, Terraria.Main.ThickMouse, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Graphics.Capture.CaptureInterface.Draw(), and Terraria.Graphics.Capture.CaptureInterface.ModeEdgeSelection.DrawCursors().