protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _bitmapFont = Content.Load<BitmapFont>("Fonts/courier-new-32");
            _tiledMap = Content.Load<TiledMap>("Tilesets/level01");

            _world.CreateGrid(_tiledMap.GetLayer<TiledTileLayer>("Tile Layer 1"));

            var fireballTexture = Content.Load<Texture2D>("Sprites/fireball");
            var spriteSheetAtlas = TextureAtlas.Create(fireballTexture, 512, 197);

            _sprite = new Sprite(spriteSheetAtlas[0])
            {
                Position = new Vector2(850, 200),
                Scale = new Vector2(0.5f)
            };
            _spriteAnimator = new SpriteAnimator(_sprite, spriteSheetAtlas, 15);

            var zombieSheet = Content.Load<TextureAtlas>("Sprites/zombie-atlas");
            _zombie = new Zombie(zombieSheet)
            {
                Position = new Vector2(300, 500)
            };

            _world.CreateBody(_zombie);
        }
        public static void DrawString(this SpriteBatch spriteBatch, BitmapFont bitmapFont, string text, Vector2 position, Color color)
        {
            var dx = position.X;
            var dy = position.Y;

            foreach (char character in text)
            {
                var fontRegion = bitmapFont.GetCharacterRegion(character);

                if (fontRegion != null)
                {
                    var fontChar = fontRegion.FontCharacter;
                    var charPosition = new Vector2(dx + fontChar.XOffset, dy + fontChar.YOffset);

                    spriteBatch.Draw(fontRegion.TextureRegion, charPosition, color);
                    dx += fontChar.XAdvance;
                }

                if (character == '\n')
                {
                    dy += bitmapFont.LineHeight;
                    dx = position.X;
                }
            }
        }
 protected override void LoadContent()
 {
     _backgroundTexture = Content.Load<Texture2D>("vignette");
     _bitmapFont = Content.Load<BitmapFont>("montserrat-32");
     
     _spriteBatch = new SpriteBatch(GraphicsDevice);
 }
示例#4
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _bitmapFont = Content.Load<BitmapFont>("montserrat-32");

            var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480);
            _camera = new Camera2D(viewportAdapter)
            {
                Zoom = 2.0f
            };
            _sceneGraph = new SceneGraph();

            var carHullTexture = Content.Load<Texture2D>("car-hull");
            var carHullSprite = new Sprite(carHullTexture);
            var carWheelTexture = Content.Load<Texture2D>("car-wheel");
            var carWheelSprite = new Sprite(carWheelTexture);

            _carNode = new SceneNode("car-hull", viewportAdapter.Center.ToVector2());
            _carNode.Entities.Add(carHullSprite);

            _leftWheelNode = new SceneNode("left-wheel", new Vector2(-29, 17));
            _leftWheelNode.Entities.Add(carWheelSprite);

            _rightWheelNode = new SceneNode("right-wheel", new Vector2(40, 17));
            _rightWheelNode.Entities.Add(carWheelSprite);

            _carNode.Children.Add(_rightWheelNode);
            _carNode.Children.Add(_leftWheelNode);
            _sceneGraph.RootNode.Children.Add(_carNode);
        }
示例#5
0
        //protected override void Initialize()
        //{
        //    base.Initialize();

        //    _graphicsDeviceManager.IsFullScreen = true;
        //    _graphicsDeviceManager.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
        //    _graphicsDeviceManager.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
        //    _graphicsDeviceManager.ApplyChanges();
        //}

        protected override void LoadContent()
        {
            _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480);
            _font = Content.Load<BitmapFont>("Fonts/courier-new-32");

            _camera = new Camera2D(_viewportAdapter);
            _explosionAnimations = Content.Load<SpriteSheetAnimationGroup>("explosion-animations");

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _backgroundTexture = Content.Load<Texture2D>("black");

            var bulletTexture = Content.Load<Texture2D>("laserBlue03");
            var bulletRegion = new TextureRegion2D(bulletTexture);
            _bulletFactory = new BulletFactory(_entityManager, bulletRegion);

            SpawnPlayer(_bulletFactory);

            _meteorFactory = new MeteorFactory(_entityManager, Content);

            for (var i = 0; i < 13; i++)
            {
                _meteorFactory.SpawnNewMeteor(_player.Position);
            }
        }
 protected override void LoadContent()
 {
     _spriteBatch = new SpriteBatch(GraphicsDevice);
     _backgroundTexture = Content.Load<Texture2D>("hills");
     _bitmapFont = Content.Load<BitmapFont>("courier-new-32");
     _tiledMap = Content.Load<TiledMap>("level01");
 }
        public static void DrawString(this SpriteBatch spriteBatch, BitmapFont bitmapFont, string text, Vector2 position, Color color, int wrapWidth)
        {
            var dx = position.X;
            var dy = position.Y;
            var sentences = text.Split(new[] {'\n'}, StringSplitOptions.None);

            foreach (var sentence in sentences)
            {
                var words = sentence.Split(new[] { ' ' }, StringSplitOptions.None);

                for (var i = 0; i < words.Length; i++)
                {
                    var word = words[i];
                    var size = bitmapFont.GetStringRectangle(word, Vector2.Zero);

                    if (i != 0 && dx + size.Width >= wrapWidth)
                    {
                        dy += bitmapFont.LineHeight;
                        dx = position.X;
                    }

                    DrawString(spriteBatch, bitmapFont, word, new Vector2(dx, dy), color);
                    dx += size.Width + bitmapFont.GetCharacterRegion(' ').FontCharacter.XAdvance;
                }

                dx = position.X;
                dy += bitmapFont.LineHeight;
            }
        }
示例#8
0
        public Button(string text, Vector2 position)
        {
            Position = position;
            _text = text;

            _texture = WorldMap.Instance.GetContent().Load<Texture2D>("button");
            _spriteFont = WorldMap.Instance.GetContent().Load<BitmapFont>("Fonts/pressStart2P");
        }
示例#9
0
        public TextArea(string text, Vector2 position, Vector2 dim)
        {
            Position = position;
            _dim = dim;
            _font = WorldMap.Instance.GetContent().Load<BitmapFont>("Fonts/pressStart2P");

            HandleText(text);
        }
示例#10
0
 public Window(string name, bool snapToCamera)
 {
     Name = name;
     _snapToCamera = snapToCamera;
     _cameraStartPos = WorldMap.Instance.Camera.Position;
     _windowTexture = GameLoop.GlobalContent.Load<Texture2D>("windowTile");
     // http://dylanwilson.net/bmfont-rendering-with-monogame-extended
     _font = GameLoop.GlobalContent.Load<BitmapFont>("Fonts/pressStart2P");
 }
示例#11
0
        protected override void LoadContent()
        {
            _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480);
            _camera = new Camera2D(_viewportAdapter);
            _backgroundTexture = Content.Load<Texture2D>("vignette");
            _bitmapFont = Content.Load<BitmapFont>("montserrat-32");

            _spriteBatch = new SpriteBatch(GraphicsDevice);
        }
示例#12
0
        public NumberChooser(Vector2 position, int maxValue, int outOf)
        {
            OutOf = outOf;
            Number = 0;
            Position = position;
            MaxValue = maxValue;

            _texture = GameLoop.GlobalContent.Load<Texture2D>("numberChooser");
            _spriteFont = GameLoop.GlobalContent.Load<BitmapFont>("Fonts/pressStart2P");
        }
示例#13
0
        public DropDown(Vector2 position, List<string> options, string selected)
        {
            Position = position;
            Options = options;
            Selected = selected;

            _texture = WorldMap.Instance.GetContent().Load<Texture2D>("dropdown");
            _dropdownTWindow = WorldMap.Instance.GetContent().Load<Texture2D>("dropdownWindow");
            _spriteFont = WorldMap.Instance.GetContent().Load<BitmapFont>("Fonts/pressStart2P");
        }
示例#14
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _texture = Content.Load<Texture2D>("monogame-extended-logo");
            _bitmapFont = Content.Load<BitmapFont>("montserrat-32");
            _sprite = new Sprite(_texture) { Position = new Vector2(600, 240) };

            _tiledMap = Content.Load<TiledMap>("untitled");
            //_camera.LookAt(new Vector2(_tiledMap.WidthInPixels, _tiledMap.HeightInPixels) * 0.5f);
        }
 public static void DrawRightText(this SpriteBatch spriteBatch, BitmapFont font, string text,
     Vector2 position, Color color, Color? shadowColor = null)
 {
     var width = SceneManager.Instance.VirtualSize.X;
     var pos = new Vector2(width - font.MeasureString(text).X - position.X, position.Y);
     if (shadowColor.HasValue)
         spriteBatch.DrawTextWithShadow(font, text, pos, color, shadowColor.Value);
     else
         spriteBatch.DrawString(font, text, pos, color);
 }
示例#16
0
 /// <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);
     Circle.LoadContent(Content);
     Button.LoadContent(Content);
     ChinesePeice.LoadContent(Content);
     CheckersPiece.LoadContent(Content);
     ChessPiece.LoadContent(Content);
     logo = Content.Load<Texture2D>("Logo");
     _backgroundTexture = Content.Load<Texture2D>("vignette");
     font = Content.Load<BitmapFont>("alphabet");
 }
示例#17
0
        public SquareDropdown(Vector2 position, string option1, string option2, string selected, string name)
        {
            Position = position;
            _option1 = option1;
            _option2 = option2;
            Selected = selected;
            _name = name;

            _texture = WorldMap.Instance.GetContent().Load<Texture2D>("squareButton");
            _arrows = WorldMap.Instance.GetContent().Load<Texture2D>("arrows");
            _spriteFont = WorldMap.Instance.GetContent().Load<BitmapFont>("Fonts/pressStart2P");
            _arrowDown = WorldMap.Instance.GetContent().Load<Texture2D>("arrowDown");
        }
示例#18
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _bitmapFont = Content.Load<BitmapFont>("montserrat-32");
            _tiledMap = Content.Load<TiledMap>("level01");

            var viewportAdapter = new ScalingViewportAdapter(GraphicsDevice, 800, 480);
            _camera = new Camera2D(viewportAdapter)
            {
                Zoom = 0.5f,
                Position = new Vector2(_tiledMap.WidthInPixels / 4f, _tiledMap.HeightInPixels / 4f)
            };
        }
示例#19
0
        //protected override void Initialize()
        //{
        //    base.Initialize();

        //    _graphicsDeviceManager.IsFullScreen = true;
        //    _graphicsDeviceManager.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
        //    _graphicsDeviceManager.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
        //    _graphicsDeviceManager.ApplyChanges();
        //}

        protected override void LoadContent()
        {
            _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480);
            _guiManager = new GuiManager(_viewportAdapter, GraphicsDevice);
            _font = Content.Load<BitmapFont>("Fonts/courier-new-32");

            var normal = new GuiTextureRegionDrawable(new TextureRegion2D(Content.Load<Texture2D>("Gui/button-normal")));
            var pressed = new GuiTextureRegionDrawable(new TextureRegion2D(Content.Load<Texture2D>("Gui/button-clicked")));
            var hover = new GuiTextureRegionDrawable(new TextureRegion2D(Content.Load<Texture2D>("Gui/button-hover")));
            var buttonStyle = new GuiButtonStyle(normal, pressed, hover);
            var button = new GuiButton(buttonStyle)
            {
                Position = new Vector2(400, 240)
            };
            button.Clicked += (sender, args) =>
            {
                if (_player != null)
                {
                    Explode(_player.Position, 3);
                    _player.Destroy();
                    _player = null;
                }
            };
            _guiManager.Controls.Add(button);

            var labelStyle = new GuiLabelStyle(_font);
            var label = new GuiLabel(labelStyle, "Hello")
            {
                Position = new Vector2(100, 100)
            };
            label.MouseUp += (sender, args) => label.Text = args.Position.ToString();
            _guiManager.Controls.Add(label);
            
            _camera = new Camera2D(_viewportAdapter);
            _explosionAnimations = Content.Load<SpriteSheetAnimationGroup>("explosion-animations");

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _backgroundTexture = Content.Load<Texture2D>("black");

            var bulletTexture = Content.Load<Texture2D>("laserBlue03");
            var bulletRegion = new TextureRegion2D(bulletTexture);
            _bulletFactory = new BulletFactory(_entityManager, bulletRegion);

            SpawnPlayer(_bulletFactory);

            _meteorFactory = new MeteorFactory(_entityManager, Content);

            for (var i = 0; i < 13; i++)
                _meteorFactory.SpawnNewMeteor(_player.Position);
        }
示例#20
0
        protected override void LoadContent()
        {
            _bitmapFont = Content.Load<BitmapFont>("montserrat-32");
            _backgroundSky = Content.Load<Texture2D>("hills-sky");
            _backgroundClouds = Content.Load<Texture2D>("hills-clouds");

            _backgroundHills = new Texture2D[4];
            _backgroundHills[0] = Content.Load<Texture2D>("hills-1");
            _backgroundHills[1] = Content.Load<Texture2D>("hills-2");
            _backgroundHills[2] = Content.Load<Texture2D>("hills-3");
            _backgroundHills[3] = Content.Load<Texture2D>("hills-4");

            _spriteBatch = new SpriteBatch(GraphicsDevice);
        }
示例#21
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _bitmapFont = Content.Load<BitmapFont>("Fonts/courier-new-32");
            _tiledMap = Content.Load<TiledMap>("Tilesets/test-tileset-left-up");

            _world = new CollisionWorld(new Vector2(0, 900));
            _world.CreateGrid(_tiledMap.GetLayer<TiledTileLayer>("Tile Layer 1"));

            var zombieAnimator = Content.Load<SpriteSheetAnimator>("Sprites/zombie-animations");
            _zombie = new Zombie(zombieAnimator);
            var zombieActor = _world.CreateActor(_zombie);
            zombieActor.Position = new Vector2(462.5f, 896f);
        }
示例#22
0
        public PriorityBox(string name, GlobalJobType type, Func<NumberChooser, int, bool> validator)
        {
            Type = type;
            Name = name;
            _windowTexture = GameLoop.GlobalContent.Load<Texture2D>("priorityBox");
            _font = GameLoop.GlobalContent.Load<BitmapFont>("Fonts/pressStart2P");
            Priority = 1000000;

            int max = 0;

            if (name == "Mining" || name == "Hauling")
                max = 9999;

            _numberChooser = new NumberChooser(new Vector2(230, 10), max, 0, validator);

            AddGuiComponent(_numberChooser);
        }
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _backgroundTexture = Content.Load<Texture2D>("hills");
            _bitmapFont = Content.Load<BitmapFont>("courier-new-32");

            var textureAtlas = Content.Load<TextureAtlas>("test-tileset-atlas");
            var textureRegion = textureAtlas.Regions.First();
            _textureRegion = textureAtlas.Regions.Last();
            _sprite = new Sprite(textureRegion)
            {
                Position = new Vector2(600, 240),
                Scale = Vector2.One * 2.5f,
                OriginNormalized = new Vector2(0.25f, 0.75f)
            };
            _tiledMap = Content.Load<TiledMap>("level01");
        }
示例#24
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _bitmapFont = Content.Load<BitmapFont>("montserrat-32");

            _samples = new []
                {
                    new SampleMetadata("Bitmap Fonts", () => new BitmapFontsSample(this)),
                    new SampleMetadata("Sprites", () => new SpritesSample(this)),
                    new SampleMetadata("Input Listeners", () => new InputListenersSample(this)),
                    new SampleMetadata("Camera2D", () => new Camera2DSample(this)),
                    new SampleMetadata("Viewport Adapters", () => new ViewportAdaptersSample(this)),
                    new SampleMetadata("Tiled Maps", () => new TiledMapsSample(this))
                }
                .OrderBy(i => i.Name)
                .ToArray();

            _selectedIndex = 0;
        }
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _bitmapFont = Content.Load<BitmapFont>("Fonts/courier-new-32");
            _tiledMap = Content.Load<TiledMap>("level01");

            var fireballTexture = Content.Load<Texture2D>("fireball");
            var spriteSheetAtlas = TextureAtlas.Create(fireballTexture, 512, 197);

            _sprite = new Sprite(spriteSheetAtlas.First())
            {
                Position = new Vector2(850, 200),
                Scale = new Vector2(0.5f)
            };
            _spriteAnimator = new SpriteAnimator(_sprite, spriteSheetAtlas, 15);

            var zombieSheet = Content.Load<TextureAtlas>("zombie-atlas");
            _zombie = new Zombie(zombieSheet)
            {
                Position = new Vector2(300, 900)
            };
        }
示例#26
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            var builder = new ContainerBuilder();
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            builder.RegisterInstance(spriteBatch);
            world = new World(new Vector2(0.0f, 0.0f));
            builder.RegisterInstance(world);
            builder.RegisterInstance(Content);
            builder.RegisterType<SpriteFactory>().SingleInstance();
            builder.RegisterType<LevelOne>();
            container = builder.Build();

            // setup camera
            view = Matrix.Identity;
            camera = Vector2.Zero;

            bitmapFontConsolas16 = Content.Load<BitmapFont>("Fonts/consolas_16");

            currentScene = container.Resolve<LevelOne>();

            debugBoxVertices = new[]
            {
                new VertexPositionColor(new Vector3(0, 0, 0), Color.White),
                new VertexPositionColor(new Vector3(ViewConst.Width, ViewConst.Height, 0), Color.White),
                new VertexPositionColor(new Vector3(ViewConst.Width, 0, 0), Color.White),
                new VertexPositionColor(new Vector3(0, ViewConst.Height, 0), Color.White)
            };
            debugBasicEffect = new BasicEffect(GraphicsDevice);
            debugBasicEffect.World = Matrix.CreateOrthographicOffCenter(0, ViewConst.Width, ViewConst.Height, 0, 0, 1);
        }
示例#27
0
文件: Etiqueta.cs 项目: karv/Moggle
		/// <summary>
		/// Vincula el contenido a campos de clase
		/// </summary>
		protected override void InitializeContent ()
		{
			font = Screen.Content.GetContent<BitmapFont> (UseFont);
		}
示例#28
0
 /// <summary>
 ///     Adds a string to a batch of sprites for rendering using the specified font, text, position, color,
 ///     and width (in pixels) where to wrap the text at. The text is drawn on layer 0f.
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="font">A font for displaying text.</param>
 /// <param name="text">The text message to display.</param>
 /// <param name="position">The location (in screen coordinates) to draw the text.</param>
 /// <param name="color">
 ///     The <see cref="Color" /> to tint a sprite. Use <see cref="Color.White" /> for full color with no
 ///     tinting.
 /// </param>
 /// <param name="wrapWidth">The width (in pixels) where to wrap the text at.</param>
 public static void DrawString(this SpriteBatch spriteBatch, BitmapFont font, string text, Vector2 position, Color color)
 {
     DrawString(spriteBatch, font, text, position, color, rotation: 0, origin: Vector2.Zero, scale: Vector2.One, effect: SpriteEffects.None, layerDepth: 0);
 }
示例#29
0
 /// <summary>
 ///     Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation,
 ///     origin, scale, effects and layer.
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="font">A font for displaying text.</param>
 /// <param name="text">The text message to display.</param>
 /// <param name="position">The location (in screen coordinates) to draw the text.</param>
 /// <param name="color">
 ///     The <see cref="Color" /> to tint a sprite. Use <see cref="Color.White" /> for full color with no
 ///     tinting.
 /// </param>
 /// <param name="rotation">Specifies the angle (in radians) to rotate the text about its origin.</param>
 /// <param name="origin">The origin for each letter; the default is (0,0) which represents the upper-left corner.</param>
 /// <param name="scale">Scale factor.</param>
 /// <param name="effect">Effects to apply.</param>
 /// <param name="layerDepth">
 ///     The depth of a layer. By default, 0 represents the front layer and 1 represents a back layer.
 ///     Use SpriteSortMode if you want sprites to be sorted during drawing.
 /// </param>
 public static void DrawString(this SpriteBatch spriteBatch, BitmapFont font, string text, Vector2 position,
                               Color color, float rotation, Vector2 origin, float scale, SpriteEffects effect, float layerDepth)
 {
     DrawString(spriteBatch, font, text, position, color, rotation, origin, new Vector2(scale, scale), effect, layerDepth);
 }
示例#30
0
 public Label(string text, Vector2 position)
 {
     Position = position;
     _text = text;
     _font = GameLoop.GlobalContent.Load<BitmapFont>("Fonts/pressStart2P");
 }
 public static void DrawString(this SpriteBatch spriteBatch, BitmapFont font, StringBuilder text, Vector2 position,
                               Color color, float rotation, Vector2 origin, float scale, SpriteEffects effect, float layerDepth, Rectangle?clippingRectangle = null)
 {
     DrawString(spriteBatch, font, text, position, color, rotation, origin, new Vector2(scale, scale), effect, layerDepth, clippingRectangle);
 }
示例#32
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            IsFixedTimeStep = true;
            _gameServer = new GameServer(this);
            _gameServer.Start();

            _lineTexture = new Texture2D(GraphicsDevice, 1, 1);
            _lineTexture.SetData<Color>(
            new Color[] { Color.White });// fill the texture with white

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            var viewMap = Content.Load<TiledMap>("new_map");
            _mapEntity = ObjectMapper.CreateEntityById();
            var mapComponent = new MapComponent();
            mapComponent.Map = viewMap;
            mapComponent.Device = GraphicsDevice;
            mapComponent.Texture = Content.Load<Texture2D>("roguelikeSheet_transparent");
            _mapEntity.AddComponent(mapComponent);

            var mapData = (MapData)ObjectMapper.Create((uint)_mapEntity.UniqueId, typeof(MapData));
            mapData.Load(_gameServer, viewMap);

            _font = Content.Load<BitmapFont>("hack_font");
        }
示例#33
0
			/// <summary>
			/// </summary>
			/// <param name="font">Fuente del texto</param>
			/// <param name="texturaIcon">Textura del icono</param>
			/// <param name="str">Texto</param>
			/// <param name="colorTexto">Color del texto.</param>
			/// <param name="colorIcon">Color del icon.</param>
			public IconTextEntry (BitmapFont font,
			                      Texture2D texturaIcon,
			                      string str,
			                      Color colorTexto,
			                      Color colorIcon)
			{
				Font = font;
				TexturaIcon = texturaIcon;
				Str = str;
				Tamaño = new Point (Font.LineHeight, 24);
				ColorTexto = colorTexto;
				ColorIcon = colorIcon;
			}
 /// <summary>
 ///     Adds a string to a batch of sprites for rendering using the specified font, text, position, color, layer,
 ///     and width (in pixels) where to wrap the text at.
 /// </summary>
 /// <remarks>
 ///     <see cref="BitmapFont" /> objects are loaded from the Content Manager. See the <see cref="BitmapFont" /> class for
 ///     more information.
 ///     Before any calls to <see cref="DrawString" /> you must call <see cref="SpriteBatch.Begin" />. Once all calls to
 ///     <see cref="DrawString" /> are complete, call <see cref="SpriteBatch.End" />.
 ///     Use a newline character (\n) to draw more than one line of text.
 /// </remarks>
 /// <param name="spriteBatch"></param>
 /// <param name="font">A font for displaying text.</param>
 /// <param name="text">The text message to display.</param>
 /// <param name="position">The location (in screen coordinates) to draw the text.</param>
 /// <param name="color">
 ///     The <see cref="Color" /> to tint a sprite. Use <see cref="Color.White" /> for full color with no
 ///     tinting.
 /// </param>
 /// <param name="layerDepth">
 ///     The depth of a layer. By default, 0 represents the front layer and 1 represents a back layer.
 ///     Use SpriteSortMode if you want sprites to be sorted during drawing.
 /// </param>
 /// <param name="clippingRectangle">Clips the boundaries of the text so that it's not drawn outside the clipping rectangle</param>
 public static void DrawString(this SpriteBatch spriteBatch, BitmapFont font, string text, Vector2 position, Color color, float layerDepth, Rectangle?clippingRectangle = null)
 {
     DrawString(spriteBatch, font, text, position, color, rotation: 0, origin: Vector2.Zero, scale: Vector2.One, effect: SpriteEffects.None,
                layerDepth: layerDepth, clippingRectangle: clippingRectangle);
 }
示例#35
0
 public StringBuilderGlyphEnumerable(BitmapFont font, StringBuilder text, Point2?position)
 {
     _enumerator = new StringBuilderGlyphEnumerator(font, text, position);
 }