本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.SpriteFont类的典型用法代码示例。如果您正苦于以下问题:C# SpriteFont类的具体用法?C# SpriteFont怎么用?C# SpriteFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpriteFont类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了SpriteFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Toolbar
public Toolbar(Texture2D texture, SpriteFont font, Vector2 position)
{
_texture = texture;
_font = font;
_position = position;
_textPosition=new Vector2(130,_position.Y+10);
}
示例2: MenuManager
public MenuManager(Main game, String[] strMenuTextures,
String strMenuFont, Integer2 textureBorderPadding)
: base(game)
{
this.game = game;
//nmcg - create an array of textures
this.menuTextures = new Texture2D[strMenuTextures.Length];
//nmcg - load the textures
for (int i = 0; i < strMenuTextures.Length; i++)
{
this.menuTextures[i] =
game.Content.Load<Texture2D>(@"" + strMenuTextures[i]);
}
//nmcg - load menu font
this.menuFont = game.Content.Load<SpriteFont>(@"" + strMenuFont);
//nmcg - stores all menu item (e.g. Save, Resume, Exit) objects
this.menuItemList = new List<MenuItem>();
//sets menu texture to fullscreen minus and padding on XY
this.textureRectangle = menuTextures[0].Bounds;
}
示例3: Button
/// <summary>
/// Initializes a new instance of the <see cref="Button"/> class.
/// </summary>
/// <param name="texture">The texture.</param>
/// <param name="color">The color.</param>
/// <param name="spriteFont">The sprite font.</param>
/// <param name="text">The text.</param>
/// <param name="textColor">Color of the text.</param>
public Button(Texture2D texture, Color color, SpriteFont spriteFont, String text, Color textColor)
: base(texture, color, new Vector2(0, 0), new Vector2(1, 1), 0f)
{
_textLabel = new Label(spriteFont, text, textColor, new Vector2(0, 0), new Vector2(1, 1), 0);
_state = BState.Up;
_timer = 2f;
}
示例4: LoadContent
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// TODO: use this.Content to load your game content here
star = Content.Load<Texture2D>("star");
font = Content.Load<SpriteFont>("font");
sphereModel = Content.Load<Model>("sphere");
for (int i = 0; i < particleCount; ++i)
{
particles.Add(GetRandomParticle());
}
try
{
glove = new P5();
glove.ResetSensors();
useGlove = true;
}
catch
{
useGlove = false;
}
}
示例5: LoadContent
protected override void LoadContent()
{
this.EndTexture = Content.Load<Texture2D>("Transparent25Percent");
this.font = Content.Load<SpriteFont>("NFont");
base.LoadContent();
}
示例6: Event
public Event(SpriteBatch _s, GraphicsDevice _g,SpriteFont _font)
{
s = _s;
g = _g;
font = _font;
posBGI.X = 0;
posBGI.Y = 0;
posLeft0.X = 0;
posLeft0.Y = 10;
posLeft1.X = 60;
posLeft1.Y = 10;
posRight0.X = 480;
posRight0.Y = 10;
posRight1.X = 520;
posRight1.Y = 10;
posFrame.X = 10;
posFrame.Y = 340;
posName.X = 100;
posName.Y = 355;
posTalk.X = 50;
posTalk.Y = 400;
serif = new List<string>();
Stream stream;
stream = File.OpenRead("images/hb1.png");
imgBGI = Texture2D.FromStream(g, stream);
stream = File.OpenRead("images/sowaku.png");
imgFrame = Texture2D.FromStream(g, stream);
}
示例7: LoadContent
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent ()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch (GraphicsDevice);
//TODO: use this.Content to load your game content here
monkey = Content.Load<Texture2D> ("monkey");
background = Content.Load <Texture2D> ("background");
logo = Content.Load<Texture2D> ("logo");
font = Content.Load<SpriteFont> ("font");
hit = Content.Load<SoundEffect> ("hit");
title = Content.Load<Song> ("title");
Microsoft.Xna.Framework.Media.MediaPlayer.IsRepeating = true;
Microsoft.Xna.Framework.Media.MediaPlayer.Play (title);
var viewport = graphics.GraphicsDevice.Viewport;
var padding = (viewport.Width / 100);
var gridWidth = (viewport.Width - (padding * 5)) / 4;
var gridHeight = gridWidth;
for (int y = padding; y < gridHeight*5; y+=gridHeight+padding) {
for (int x = padding; x < viewport.Width-gridWidth; x+=gridWidth+padding) {
grid.Add (new GridCell () {
DisplayRectangle = new Rectangle (x, y, gridWidth, gridHeight)
});
}
}
}
示例8: LoadContent
public static void LoadContent(ContentManager cm)
{
Arial = cm.Load<SpriteFont>(@"fonts\Arial");
Tahoma = cm.Load<SpriteFont>(@"fonts\Tahoma");
Calibri = cm.Load<SpriteFont>(@"fonts\Calibri");
Verdana = cm.Load<SpriteFont>(@"fonts\Verdana");
}
示例9: Interface
public Interface(Game game)
: base(game)
{
_font = Game.Content.Load<SpriteFont>("Test");
_heartTexture = Game.Content.Load<Texture2D>("heart");
_potionTexture = Game.Content.Load<Texture2D>("potion");
}
示例10: Tooltip
public Tooltip(string str, SpriteFont Font, Color Color)
{
text = str;
font = Font;
location = new Vector2(Input.mousePosition.X, Input.mousePosition.Y);
color = Color;
}
示例11: LoadContent
protected override void LoadContent()
{
base.LoadContent();
ContentManager Content = Game.Content;
font = Content.Load<SpriteFont>(@"Fonts/ControlFont");
pos = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
}
示例12: TitleCard
public TitleCard(SpriteBatch spriteBatch, RogueLike ingame)
{
this.spriteBatch = spriteBatch;
this.ingame = ingame;
overlay = ingame.Content.Load<Texture2D>("overlay.png");
output128 = ingame.Content.Load<SpriteFont>("Output128pt");
}
示例13: Initialize
public override void Initialize()
{
this.spriteBatch = EntitySystem.BlackBoard.GetEntry<SpriteBatch>("SpriteBatch");
this.font = EntitySystem.BlackBoard.GetEntry<SpriteFont>("SpriteFont");
healthMapper = new ComponentMapper<Health>(world);
transformMapper = new ComponentMapper<Transform>(world);
}
示例14: TextButton
public TextButton(String text, SpriteFont font, Vector2 pos, Texture2D up, Texture2D down, Vector2 center = default(Vector2))
: base(pos, new Vector2(0,0), up, down, center)
{
this.text = text;
this.font = font;
this.size = new Vector2(FONT_SIZE * text.Length + 2*MARGIN, 1.6f * FONT_SIZE + 2*MARGIN);
}
示例15: MpqConsole
/// <summary>
/// Creates a new MpqConsole
/// </summary>
public MpqConsole(Game game, SpriteFont font)
: base(game)
{
Console = new XnaConsoleComponent(game, font);
game.Components.Add(Console);
Console.Prompt(Prompt, Execute);
}