当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.SpriteFont类代码示例

本文整理汇总了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);
 }
开发者ID:hover024,项目名称:Virus-Attack,代码行数:7,代码来源:Toolbar.cs

示例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;
        }
开发者ID:Resinderate,项目名称:ShadowMadness,代码行数:25,代码来源:MenuManager.cs

示例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;
 }
开发者ID:nowaksmini,项目名称:cadcam,代码行数:15,代码来源:Button.cs

示例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;
            }

        }
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:34,代码来源:GloveGame.cs

示例5: LoadContent

        protected override void LoadContent()
        {
            this.EndTexture = Content.Load<Texture2D>("Transparent25Percent");
            this.font = Content.Load<SpriteFont>("NFont");
            base.LoadContent();

        }
开发者ID:guorenxu,项目名称:FoodSpace,代码行数:7,代码来源:EndState.cs

示例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);
        }
开发者ID:TowerTin,项目名称:SourceCode,代码行数:31,代码来源:Event.cs

示例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)
					});
				}
			}
		}
开发者ID:infinitespace-studios,项目名称:Monkey.Tap,代码行数:32,代码来源:Game1.cs

示例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");
 }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:7,代码来源:Fonts.cs

示例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");
 }
开发者ID:floAr,项目名称:WarTornLands,代码行数:7,代码来源:Interface.cs

示例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;
 }
开发者ID:BenHamrick,项目名称:Heart-Attack-2013-Game-Jam,代码行数:7,代码来源:Tooltip.cs

示例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);
 }
开发者ID:erob2620,项目名称:Space-Wizards,代码行数:7,代码来源:DialogState.cs

示例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");
 }
开发者ID:HStocker,项目名称:RogueLike,代码行数:7,代码来源:TitleCard.cs

示例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);
 }
开发者ID:dackjaniels2001,项目名称:starwarrior_CSharp,代码行数:7,代码来源:HealthBarRenderSystem.cs

示例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);
 }
开发者ID:dah6ce,项目名称:Blink,代码行数:7,代码来源:TextButton.cs

示例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);
 }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:10,代码来源:MpqConsole.cs


注:本文中的Microsoft.Xna.Framework.Graphics.SpriteFont类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。