1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| public class Textures
{
...
public static Texture2D[] Arrows;
public static void Load()
{
...
loadArrows();
}
private static void loadArrows()
{
Arrows = new Texture2D[4];
string[] str = new string[4];
str[0] = "▲";
str[1] = "▼";
str[2] = "◀";
str[3] = "▶";
RenderTarget2D renderTarget = new RenderTarget2D(Globals.Graphics.GraphicsDevice, 32, 32);
Globals.Graphics.GraphicsDevice.SetRenderTarget(renderTarget);
for (byte i = 0; i < 4; i++)
{
Globals.Graphics.GraphicsDevice.Clear(Color.Transparent);
Globals.SpriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
Globals.SpriteBatch.DrawString(Fonts.Kootenay_10, str[i], new Vector2(0, 0), Color.Black, 0, new Vector2(0, 0), 3, SpriteEffects.None, 0);
Arrows[i] = renderTarget;
Globals.SpriteBatch.End();
}
Globals.Graphics.GraphicsDevice.SetRenderTarget(null);
}
} |
Partager