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

◆ InternalDraw()

void ReLogic.Graphics.DynamicSpriteFont.InternalDraw ( string text,
SpriteBatch spriteBatch,
Vector2 startPosition,
Color color,
float rotation,
Vector2 origin,
ref Vector2 scale,
SpriteEffects spriteEffects,
float depth )
inlinepackage

Definition at line 111 of file DynamicSpriteFont.cs.

112 {
113 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
114 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
115 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
116 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
117 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
118 //IL_0040: Unknown result type (might be due to invalid IL or missing references)
119 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
120 //IL_0046: Unknown result type (might be due to invalid IL or missing references)
121 //IL_0047: Unknown result type (might be due to invalid IL or missing references)
122 //IL_004c: Unknown result type (might be due to invalid IL or missing references)
123 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
124 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
125 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
126 //IL_0063: Unknown result type (might be due to invalid IL or missing references)
127 //IL_0094: Unknown result type (might be due to invalid IL or missing references)
128 //IL_0077: Unknown result type (might be due to invalid IL or missing references)
129 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
130 //IL_0123: Unknown result type (might be due to invalid IL or missing references)
131 //IL_013f: Unknown result type (might be due to invalid IL or missing references)
132 //IL_0144: Unknown result type (might be due to invalid IL or missing references)
133 //IL_0148: Unknown result type (might be due to invalid IL or missing references)
134 //IL_014d: Unknown result type (might be due to invalid IL or missing references)
135 //IL_014f: Unknown result type (might be due to invalid IL or missing references)
136 //IL_0175: Unknown result type (might be due to invalid IL or missing references)
137 //IL_016c: Unknown result type (might be due to invalid IL or missing references)
138 //IL_0193: Unknown result type (might be due to invalid IL or missing references)
139 //IL_019e: Unknown result type (might be due to invalid IL or missing references)
140 //IL_01df: Unknown result type (might be due to invalid IL or missing references)
141 //IL_01b0: Unknown result type (might be due to invalid IL or missing references)
142 //IL_01f1: Unknown result type (might be due to invalid IL or missing references)
143 //IL_0200: Unknown result type (might be due to invalid IL or missing references)
144 //IL_0209: Unknown result type (might be due to invalid IL or missing references)
145 //IL_020a: Unknown result type (might be due to invalid IL or missing references)
146 //IL_0215: Unknown result type (might be due to invalid IL or missing references)
147 //IL_0230: Unknown result type (might be due to invalid IL or missing references)
148 //IL_024d: Unknown result type (might be due to invalid IL or missing references)
149 //IL_024f: Unknown result type (might be due to invalid IL or missing references)
150 //IL_0250: Unknown result type (might be due to invalid IL or missing references)
151 //IL_0255: Unknown result type (might be due to invalid IL or missing references)
152 //IL_025f: Unknown result type (might be due to invalid IL or missing references)
153 //IL_0263: Unknown result type (might be due to invalid IL or missing references)
154 //IL_026d: Unknown result type (might be due to invalid IL or missing references)
155 //IL_0271: Unknown result type (might be due to invalid IL or missing references)
156 //IL_0278: Unknown result type (might be due to invalid IL or missing references)
157 //IL_027d: Unknown result type (might be due to invalid IL or missing references)
158 //IL_028f: Unknown result type (might be due to invalid IL or missing references)
159 //IL_0296: Unknown result type (might be due to invalid IL or missing references)
160 //IL_02a6: Unknown result type (might be due to invalid IL or missing references)
161 Matrix matrix = Matrix.CreateTranslation((0f - origin.X) * scale.X, (0f - origin.Y) * scale.Y, 0f) * Matrix.CreateRotationZ(rotation);
164 bool flag = true;
165 float x = 0f;
166 if ((int)spriteEffects != 0)
167 {
169 if (((Enum)spriteEffects).HasFlag((Enum)(object)(SpriteEffects)1))
170 {
171 x = vector.X * scale.X;
172 one.X = -1f;
173 }
174 if (((Enum)spriteEffects).HasFlag((Enum)(object)(SpriteEffects)2))
175 {
176 zero.Y = (vector.Y - (float)LineSpacing) * scale.Y;
177 one.Y = -1f;
178 }
179 }
180 zero.X = x;
181 foreach (char c in text)
182 {
183 switch (c)
184 {
185 case '\n':
186 zero.X = x;
187 zero.Y += (float)LineSpacing * scale.Y * one.Y;
188 flag = true;
189 continue;
190 case '\r':
191 continue;
192 }
193 SpriteCharacterData characterData = GetCharacterData(c);
194 Vector3 kerning = characterData.Kerning;
195 Rectangle padding = characterData.Padding;
196 if (((Enum)spriteEffects).HasFlag((Enum)(object)(SpriteEffects)1))
197 {
198 padding.X -= padding.Width;
199 }
200 if (((Enum)spriteEffects).HasFlag((Enum)(object)(SpriteEffects)2))
201 {
202 padding.Y = LineSpacing - characterData.Glyph.Height - padding.Y;
203 }
204 if (flag)
205 {
206 kerning.X = Math.Max(kerning.X, 0f);
207 }
208 else
209 {
210 zero.X += CharacterSpacing * scale.X * one.X;
211 }
212 zero.X += kerning.X * scale.X * one.X;
213 Vector2 position = zero;
214 position.X += (float)padding.X * scale.X;
215 position.Y += (float)padding.Y * scale.Y;
216 Vector2.Transform(ref position, ref matrix, ref position);
217 position += startPosition;
218 spriteBatch.Draw(characterData.Texture, position, (Rectangle?)characterData.Glyph, color, rotation, Vector2.Zero, scale, spriteEffects, depth);
219 zero.X += (kerning.Y + kerning.Z) * scale.X * one.X;
220 flag = false;
221 }
222 }
void Draw(Texture2D texture, Vector2 position, Color color)
SpriteCharacterData GetCharacterData(char character)
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static Matrix CreateTranslation(Vector3 position)
Definition Matrix.cs:438
static Matrix CreateRotationZ(float radians)
Definition Matrix.cs:746
static Vector2 Transform(Vector2 position, Matrix matrix)
Definition Vector2.cs:317

References ReLogic.Graphics.DynamicSpriteFont.CharacterSpacing, Microsoft.Xna.Framework.Matrix.CreateRotationZ(), Microsoft.Xna.Framework.Matrix.CreateTranslation(), ReLogic.Graphics.DynamicSpriteFont.GetCharacterData(), ReLogic.Graphics.DynamicSpriteFont.LineSpacing, System.Math.Max(), ReLogic.Graphics.DynamicSpriteFont.MeasureString(), Microsoft.Xna.Framework.Vector2.One, System.text, Microsoft.Xna.Framework.Vector2.Transform(), Microsoft.Xna.Framework.Rectangle.Width, Microsoft.Xna.Framework.Rectangle.X, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector3.X, Microsoft.Xna.Framework.Rectangle.Y, Microsoft.Xna.Framework.Vector2.Y, Microsoft.Xna.Framework.Vector3.Z, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(), ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(), ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(), ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(), ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(), and ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString().