• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Graphics.SpriteFont类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.SpriteFont的典型用法代码示例。如果您正苦于以下问题:C# SpriteFont类的具体用法?C# SpriteFont怎么用?C# SpriteFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SpriteFont类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了SpriteFont类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Button

 public Button(SpriteFont font, string text, int posX, int posY)
 {
     _font = font;
     _text = text;
     var size = _font.MeasureString(text);
     _location = new Rectangle(posX - (int)(size.X / 2.0f), posY - (int)(size.Y / 2.0f), (int)size.X, (int)size.Y);
 }
开发者ID:cragmire,项目名称:MVA,代码行数:7,代码来源:Button.cs


示例17: LoadContent

        protected override void LoadContent()
        {
            this.font = content.Load<SpriteFont>("ConsoleFont");

            this.placeHolder = content.Load<Texture2D>("Instructions");
            this.spriteTexture = content.Load<Texture2D>("SpriteMarker");
            this.roundMusic = content.Load<Song>("music_game");
            this.waitMusic = content.Load<Song>("music_waiting_loop");

            NewHigh = content.Load<SoundEffect>("new_highscore");
            EndRound = content.Load<SoundEffect>("game_end");

            timeInstructionsStayAround = 10;

            MediaPlayer.Play(roundMusic);
            MediaPlayer.Volume = .3f;
            MediaPlayer.IsRepeating = true;          

            this.FirstRoundStartHasStarted = this.firstRoundOver = false;
            this.HasStartedRound = false;

            this.highScore = 0;

            if (!Lanko_And_Glub.utility.ShowInstructions)
                this.instructionsColor = new Color(0, 0, 0, 0);
            else
                this.instructionsColor = Color.White;

            this.scale = 0;

            this.fontScale = 1f;
            this.fontColor = timerColor = Color.White;

            base.LoadContent();
        }
开发者ID:Zac-Bruin,项目名称:LaG,代码行数:35,代码来源:MonogameRoundManager.cs


示例18: Setup

 private void Setup(SpriteFont font, string text, Rectangle rect)
 {
     spriteBatch = new SpriteBatch(Engine.GraphicsDevice);
     spriteFont = font;
     Rectangle = rect;
     menuText = text;
 }
开发者ID:JllyGrnGiant,项目名称:game_demo,代码行数:7,代码来源:MenuItem.cs


示例19: LoadContent

        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _camera = new Camera2D(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            _player = new Player(Content, new Vector2(400, 430));
            _player.Load("Animations.xml");

            _font = Content.Load<SpriteFont>("font");

            Debug.Assert(GraphicsDevice != null, "GraphicsDevice != null");
// ReSharper disable once PossibleLossOfFraction
            _camera.MinPosition = new Vector2(x: GraphicsDevice.Viewport.Width / 2, y: 0);
            //Camera.MaxPosition = new Vector2(map.Dimensions.X - GraphicsDevice.Viewport.Width / 2, map.Dimensions.Y / 2 - 35);
            _camera.MaxPosition = new Vector2(5000, 200);

            _camera.TrackingBody = _player;

            _levelProvider = new LevelProvider(Content, _player, _camera);
            _levelProvider.LoadMaps(GraphicsDevice, "hills.tmx");

            _hud = new HUD(Content, _player);
            _hud.Initialize();
            _hud.SetMapWidth(1000);
        }
开发者ID:blackdragon723,项目名称:RandomPlatformer,代码行数:28,代码来源:Game1.cs


示例20: MenuComponent

 public MenuComponent(SpriteFont spriteFont, string[] items)
 {
     this.spriteFont = spriteFont;
     SetMenuItems(items);
     NormalColor = Color.White;
     HiliteColor = Color.Red;
 }
开发者ID:tojuhaka,项目名称:HakaGame,代码行数:7,代码来源:MenuComponent.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.Texture类代码示例发布时间:2022-05-26
下一篇:
C# Graphics.SpriteBatch类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap