コード例 #1
0
        public static ClientEntity ClientEntityFactory(EntityMessage em, BFBContentManager content)
        {
            IGraphicsComponent graphicsComponent = null;

            switch (em.EntityType)
            {
            case EntityType.Item:
                graphicsComponent = new ItemGraphicsComponent(content.GetAtlasTexture(em.TextureKey));
                break;

            case EntityType.Mob:
            case EntityType.Player:
            case EntityType.Projectile:
            case EntityType.Particle:
                graphicsComponent = new AnimationComponent(content.GetAnimatedTexture(em.TextureKey));
                break;
            }

            return(new ClientEntity(em.EntityId,
                                    new EntityOptions
            {
                Dimensions = em.Dimensions,
                Position = em.Position,
                Rotation = em.Rotation,
                Origin = em.Origin,
                EntityType = em.EntityType
            }, graphicsComponent));
        }
コード例 #2
0
        /**
         * Used to render the UIComponent by default as a simple panel
         */
        public virtual void Render(SpriteBatch graphics, BFBContentManager content)
        {
            if (RenderAttributes.Position == Position.Relative)
            {
                RenderAttributes.X = RenderAttributes.OffsetX + Parent?.RenderAttributes.X ?? 0;
                RenderAttributes.Y = RenderAttributes.OffsetY + Parent?.RenderAttributes.Y ?? 0;
            }

            graphics.Draw(
                content.GetTexture(RenderAttributes.TextureKey),
                new Rectangle(
                    RenderAttributes.X,
                    RenderAttributes.Y,
                    RenderAttributes.Width,
                    RenderAttributes.Height),
                RenderAttributes.Background);

            if (!string.IsNullOrEmpty(Text))
            {
                graphics.DrawUIText(this, content);
            }

            if (RenderAttributes.BorderSize > 0)
            {
                graphics.DrawBorder(new Rectangle(
                                        RenderAttributes.X,
                                        RenderAttributes.Y,
                                        RenderAttributes.Width,
                                        RenderAttributes.Height),
                                    RenderAttributes.BorderSize,
                                    RenderAttributes.BorderColor,
                                    content.GetTexture("default"));
            }
        }
コード例 #3
0
        public UIManager(GraphicsDevice graphicsDevice, BFBContentManager contentManager)
        {
            _graphicsDevice = graphicsDevice;
            _contentManager = contentManager;

            _activeUILayers = new Dictionary <string, UILayer>();
            _allUILayers    = new Dictionary <string, UILayer>();
        }
コード例 #4
0
        public override void Draw(SpriteBatch graphics, BFBContentManager content)
        {
            InventorySlot slot = ClientDataRegistry.GetInstance()?.Client?.Meta?.MouseSlot;

            if (slot == null)
            {
                return;
            }

            AtlasTexture atlas = content.GetAtlasTexture(slot.TextureKey);

            int maxHeight = RootUI.RenderAttributes.Height / 10;
            int scale     = maxHeight / atlas.Height;

            int w = atlas.Width * scale;
            int h = atlas.Height * scale;


            int x = (int)Mouse.X - w / 2;
            int y = (int)Mouse.Y - h / 2;

            graphics.DrawAtlas(
                atlas,
                new Rectangle(
                    x,
                    y,
                    w,
                    h
                    ),
                Color.White);

            if (slot.ItemType == ItemType.Wall)
            {
                graphics.DrawAtlas(
                    atlas,
                    new Rectangle(
                        x,
                        y,
                        w,
                        h
                        ),
                    new Color(0, 0, 0, 0.4f));
            }

            SpriteFont font = content.GetFont("default");

            (float width, float height) = font.MeasureString(slot.Count.ToString()) * 0.6f;
            graphics.DrawString(
                font,
                slot.Count.ToString(),
                new Vector2(Mouse.X - width + 3, Mouse.Y - height + 3),
                Color.White,
                0,
                Vector2.Zero,
                0.6f,
                SpriteEffects.None,
                1);
        }
コード例 #5
0
        public void Init(WorldManager world, BFBContentManager content, GraphicsDevice graphicsDevice)
        {
            _content = content;
            Camera   = new Camera(graphicsDevice, world.MapPixelWidth(), world.MapPixelHeight());

            _tileScale   = world.WorldOptions.WorldScale;
            _blockWidth  = world.MapBlockWidth();
            _blockHeight = world.MapBlockHeight();

            _init = true;
        }
コード例 #6
0
 public void Draw(ClientEntity entity, SpriteBatch graphics, BFBContentManager content, float scale = 1)
 {
     graphics.Draw(_atlasTexture.Texture,
                   new Vector2(entity.Position.X + 15, entity.Position.Y + 15 + _yOffset),
                   new Rectangle(_atlasTexture.X, _atlasTexture.Y, _atlasTexture.Width, _atlasTexture.Height),
                   Color.White,
                   _rotation,
                   new Vector2(15 / 2f, 15 / 2f),
                   scale * 0.75f,
                   SpriteEffects.None,
                   1);
 }
コード例 #7
0
        public override void Render(SpriteBatch graphics, BFBContentManager content)
        {
            base.Render(graphics, content);

            int height = 0;

            foreach (ChatMessage chatMessage in Messages)
            {
                height += graphics.DrawChatText(height, chatMessage, this, content);
            }

            RenderAttributes.Height = height;
        }
コード例 #8
0
        public override void Render(SpriteBatch graphics, BFBContentManager content)
        {
            base.Render(graphics, content);

            string text = _selector.Compile().Invoke(_model);

            _tick++;
            if (Focused && _tick % 30 == 0)
            {
                _showCursor = !_showCursor;
            }

            if (Focused)
            {
                if (_showCursor)
                {
                    text += "  ";
                }
                else
                {
                    text += "_";
                }
            }

            #region graphics.Begin()
            //Stop global buffer
            graphics.End();

            //indicate how we are redrawing the text
            RasterizerState r = new RasterizerState {
                ScissorTestEnable = true
            };
            graphics.GraphicsDevice.ScissorRectangle = new Rectangle(RenderAttributes.X, RenderAttributes.Y, RenderAttributes.Width, RenderAttributes.Height);

            //Start new special buffer
            graphics.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, r);
            #endregion

            var font = content.GetFont(RenderAttributes.FontKey);
            //Draw our text
            DrawString(graphics, font, text, new Rectangle(RenderAttributes.X, RenderAttributes.Y, RenderAttributes.Width, RenderAttributes.Height));

            #region graphics.End()

            //Begin next drawing after ending the special buffer
            graphics.End();
            graphics.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise);

            #endregion
        }
コード例 #9
0
        public override void Render(SpriteBatch graphics, BFBContentManager content)
        {
            base.Render(graphics, content);

            EntityMeta meta = _valueSelector.Compile()?.Invoke(_model);

            if (meta == null)
            {
                return;
            }

            Vector2 cursor    = new Vector2(RenderAttributes.X, RenderAttributes.Y);
            int     width     = RenderAttributes.Width / 10;
            int     dimension = width - 5;

            ushort value     = _textureKey == "Mana" ? meta.Mana : meta.Health;
            ushort valueStep = _textureKey == "Mana" ? (ushort)(meta.MaxMana / 10) : (ushort)(meta.MaxHealth / 10);

            for (int i = 0; i < 10; i++)
            {
                string atlasKey;

                if (value - i * valueStep >= valueStep)
                {
                    atlasKey = _textureKey + ":Full";
                }
                else if (value - i * valueStep >= valueStep * 0.75f)
                {
                    atlasKey = _textureKey + ":Most";
                }
                else if (value - i * valueStep >= valueStep * 0.5f)
                {
                    atlasKey = _textureKey + ":Half";
                }
                else if (value - i * valueStep >= valueStep * 0.25f)
                {
                    atlasKey = _textureKey + ":Partial";
                }
                else
                {
                    atlasKey = _textureKey + ":Empty";
                }

                graphics.DrawAtlas(content.GetAtlasTexture(atlasKey), new Rectangle((int)cursor.X, (int)cursor.Y, dimension, dimension), Color.White);

                cursor.X += width;
            }
        }
コード例 #10
0
        public override void Render(SpriteBatch graphics, BFBContentManager content)
        {
            base.Render(graphics, content);

            int x     = RenderAttributes.X + Padding;
            int y     = RenderAttributes.Y + RenderAttributes.Height / 2 - SliderHeight / 2;
            int width = RenderAttributes.Width - Padding * 2;

            //Draw Rail
            graphics.Draw(content.GetTexture("default"), new Rectangle(x, y, width, SliderHeight), Color.Black);

            //Draw Thumb
            graphics.Draw(content.GetTexture("default"), ThumbBounds(), new Color(169, 170, 168));

            graphics.DrawBorder(ThumbBounds(), 3, new Color(211, 212, 210), content.GetTexture("default"));
        }
コード例 #11
0
        public override void Render(SpriteBatch graphics, BFBContentManager content)
        {
            Text = _propertySelector == null ? Text : _propertySelector(_model);

            base.Render(graphics, content);
        }
コード例 #12
0
        protected override void Initialize()
        {
            #region Window Options

            Window.Title              = "Boss Fight Battlegrounds";
            Window.ClientSizeChanged += Window_ClientSizeChanged;
            Window.AllowUserResizing  = true;

            #endregion

            #region Init Managers

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _globalEventManager = new EventManager <GlobalEvent>();
            _inputEventManager  = new EventManager <InputEvent>();

            _inputManager   = new InputManager(_inputEventManager);
            _contentManager = new BFBContentManager(Content, GraphicsDevice);
            _audioManager   = new AudioManager(_contentManager);
            _uiManager      = new UIManager(_graphicsDeviceManager.GraphicsDevice, _contentManager);
            _sceneManager   = new SceneManager(Content, _graphicsDeviceManager, _globalEventManager, _uiManager);

            //Map Dependencies on scenes
            Scene.SceneManager          = _sceneManager;
            Scene.AudioManager          = _audioManager;
            Scene.UIManager             = _uiManager;
            Scene.ContentManager        = _contentManager;
            Scene.GraphicsDeviceManager = _graphicsDeviceManager;
            Scene.GlobalEventManager    = _globalEventManager;
            Scene.InputEventManager     = _inputEventManager;

            //Map dependencies on UILayers
            UILayer.SceneManager       = _sceneManager;
            UILayer.UIManager          = _uiManager;
            UILayer.GlobalEventManager = _globalEventManager;

            //map dependencies to the UIComponent
            UIComponent.UIManager = _uiManager;

            //catch input events
            _inputEventManager.OnEventProcess = _uiManager.ProcessEvents;

            #endregion

            #region Register Scenes/Start Main Scene

            //Register a scene here
            _sceneManager.AddScene(new Scene[]
            {
                new MainMenuScene(),
                new GameScene(),
            });

            #endregion

            #region Register UILayers

            _uiManager.AddUILayer(new UILayer[]
            {
                new LoginUI(),
                new MainMenuUI(),
                new ServerMenuUI(),
                new AddServerUI(),
                new EditServerListUI(),
                new SettingsMenuUI(),
                new HelpUI(),
                new HudUI(),
                new GameMenuUI(),
                new MonsterMenuUI(),
                new ChatUI(),
                new StoreUI(),
                new CreditCardUI(),
                new CompletedTransactionUI(),
                new LoadingGameUI(),
                new InventoryUI(),
                new CountdownUI(),
                new GameOverUI(),
                new SoundSettingsUI(),
                new ControlUI()
            });

            #endregion

            base.Initialize();
        }
コード例 #13
0
        public static void DrawBackedText(this SpriteBatch graphics, string text, BfbVector position, BFBContentManager content, float scale = 1f)
        {
            SpriteFont font    = content.GetFont("default");
            Texture2D  texture = content.GetTexture("default");

            (float width, float height) = font.MeasureString(text);

            width  *= scale;
            height *= scale;

            //Background
            graphics.Draw(
                texture,
                new Rectangle((int)position.X - 2, (int)position.Y - 2, (int)width + 4, (int)height + 2),
                new Color(0, 0, 0, 0.5f));

            graphics.DrawString(
                font,
                text,
                position.ToVector2(),
                Color.White,
                0f,
                Vector2.Zero,
                scale,
                SpriteEffects.None,
                1);
        }
コード例 #14
0
        public static void DrawUIText(this SpriteBatch graphics, UIComponent component, BFBContentManager content)
        {
            SpriteFont font = content.GetFont(component.RenderAttributes.FontKey);

            float   scale    = 1f;
            string  text     = component.Text;
            Vector2 position = new Vector2();

            (float iWidth, float iHeight) = font.MeasureString(text);

            #region Scale Text

            //Decide how to scale the text
            if (component.RenderAttributes.FontScaleMode == FontScaleMode.ContainerFitScale)
            {
                scale  = System.Math.Min(component.RenderAttributes.Width / iWidth, component.RenderAttributes.Height / iHeight);
                scale *= 8f / 10f;
            }
            else if (component.RenderAttributes.FontScaleMode == FontScaleMode.FontSizeScale)
            {
                int pixelHeight = (int)(content.GraphicsDevice.Viewport.Width / 25f * component.RenderAttributes.FontSize);
                scale = pixelHeight / iHeight;
            }

            #endregion

            #region Wrap Text

            if (component.RenderAttributes.TextWrap == TextWrap.Wrap)
            {
                text = WrapUIComponentText(font, component.Text, component, scale);
            }

            #endregion

            #region Justify text
            if (component.RenderAttributes.JustifyText == JustifyText.Center)
            {
                position.X = component.RenderAttributes.X - (int)(iWidth * scale / 2) + component.RenderAttributes.Width / 2;
            }
            else if (component.RenderAttributes.JustifyText == JustifyText.End)
            {
                position.X = component.RenderAttributes.X + component.RenderAttributes.Width - iWidth * scale;
            }
            else if (component.RenderAttributes.JustifyText == JustifyText.Start)
            {
                position.X = component.RenderAttributes.X;
            }
            #endregion

            #region Vertical Align Text

            //Vertical align text
            if (component.RenderAttributes.VerticalAlignText == VerticalAlignText.Center)
            {
                position.Y = component.RenderAttributes.Y - (int)(iHeight * scale / 2) + component.RenderAttributes.Height / 2;
            }
            else if (component.RenderAttributes.VerticalAlignText == VerticalAlignText.End)
            {
                position.Y = component.RenderAttributes.Y + component.RenderAttributes.Height - iHeight * scale;
            }
            else if (component.RenderAttributes.VerticalAlignText == VerticalAlignText.Start)
            {
                position.Y = component.RenderAttributes.Y;
            }

            #endregion

            graphics.DrawString(
                font,
                text,
                position,
                component.RenderAttributes.Color,
                0,
                Vector2.Zero,
                scale,
                SpriteEffects.None,
                0);
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="yOffset"></param>
        /// <param name="message"></param>
        /// <param name="container"></param>
        /// <param name="content"></param>
        /// <returns>The bounds of the area the message took</returns>
        public static int DrawChatText(this SpriteBatch graphics, int yOffset, ChatMessage message, UIComponent container, BFBContentManager content)
        {
            #region InitDimensions
            Rectangle bounds = new Rectangle
            {
                X      = container.RenderAttributes.X,
                Y      = container.RenderAttributes.Y + yOffset,
                Width  = container.RenderAttributes.Width,
                Height = message.Height
            };

            message.Width = container.RenderAttributes.Width;
            #endregion

            SpriteFont font    = content.GetFont(container.RenderAttributes.FontKey);
            Texture2D  texture = content.GetTexture(container.RenderAttributes.TextureKey);

            #region Line Height and scale

            int   lineHeight = (int)(content.GraphicsDevice.Viewport.Width / 25f * container.RenderAttributes.FontSize);
            float scale      = lineHeight / font.MeasureString(" ").Y;

            #endregion

            #region Draw Background

            graphics.Draw(texture, bounds, BackgroundColors[(int)message.BackgroundColor]);

            #endregion

            Vector2 cursor         = new Vector2(bounds.X, bounds.Y);
            float   startingHeight = cursor.Y;
            int     spaceWidth     = (int)(font.MeasureString(" ").X *scale);

            cursor = graphics.DrawColoredText(font, cursor, message.Header.Text, bounds, message.Header.ForegroundColor, scale);

            foreach (ChatText chatText in message.Body)
            {
                cursor = graphics.DrawColoredText(font, cursor, chatText.Text, bounds, chatText.ForegroundColor, scale);
            }

            message.Height = (int)(cursor.Y - startingHeight) + lineHeight;

            return((int)(cursor.Y - startingHeight) + lineHeight);
        }
コード例 #16
0
        public static void DrawLine(this SpriteBatch graphics, Vector2 p1, Vector2 p2, int thickness, Color color, BFBContentManager content)
        {
            Vector2 edge   = p2 - p1;//gets slope
            int     length = (int)System.Math.Sqrt(System.Math.Pow(p2.X - p1.X, 2) + System.Math.Pow(p2.Y - p1.Y, 2));
            float   angle  = (float)System.Math.Atan2(edge.Y, edge.X);

            graphics.Draw(
                content.GetTexture("default"),
                new Rectangle((int)p1.X, (int)p1.Y, length, thickness),
                null,
                color,
                angle,
                Vector2.Zero,
                SpriteEffects.None,
                1);
        }
コード例 #17
0
        public static void DrawVector(this SpriteBatch graphics, Vector2 point, Vector2 vector, int thickness, Color color, BFBContentManager content)
        {
            Vector2 endPoint = new Vector2(point.X + vector.X, point.Y + vector.Y);

            graphics.DrawLine(point, endPoint, thickness, color, content);
        }
コード例 #18
0
        public override void Render(SpriteBatch graphics, BFBContentManager content)
        {
            base.Render(graphics, content);

            #region DrawHotbarBorder

            if (_slotId == _inventory.ActiveSlot && _hotBarMode)
            {
                graphics.DrawBorder(
                    new Rectangle(
                        RenderAttributes.X - 2,
                        RenderAttributes.Y - 2,
                        RenderAttributes.Width + 2 * 2,
                        RenderAttributes.Height + 2 * 2),
                    5,
                    Color.Silver,
                    content.GetTexture("default"));
            }

            #endregion

            #region Draw Item

            if (_inventory.GetSlots().ContainsKey(_slotId))
            {
                InventorySlot slot = _inventory.GetSlots()[_slotId];

                if (string.IsNullOrEmpty(slot.TextureKey))
                {
                    return;
                }

                AtlasTexture atlas = content.GetAtlasTexture(slot.TextureKey);

                int padding = Padding;

                if (_hover)
                {
                    padding -= 3;
                }

                int maxHeight = RenderAttributes.Height - padding * 2;
                int scale     = maxHeight / atlas.Height;

                int width  = atlas.Width * scale;
                int height = atlas.Height * scale;

                int x = RenderAttributes.X + padding;
                int y = RenderAttributes.Y + padding;

                graphics.DrawAtlas(atlas, new Rectangle(x, y, width, height), Color.White);

                if (slot.ItemType == ItemType.Wall)
                {
                    graphics.DrawAtlas(atlas, new Rectangle(x, y, width, height), new Color(0, 0, 0, 0.4f));
                }

                //draw count
                if (slot.Count <= 1)
                {
                    return;
                }

                #region Draw Stack Count

                SpriteFont font = content.GetFont(RenderAttributes.FontKey);
                graphics.DrawString(
                    font,
                    slot.Count.ToString(),
                    new Vector2(
                        RenderAttributes.X + padding,
                        RenderAttributes.Y + padding),
                    Color.White,
                    0,
                    Vector2.Zero,
                    RenderAttributes.FontSize * (graphics.GraphicsDevice.Viewport.Width / 25f) / font.MeasureString(" ").Y,
                    SpriteEffects.None,
                    1);

                #endregion
            }

            #endregion
        }
コード例 #19
0
 public void Draw(SpriteBatch graphics, BFBContentManager content, float worldScale)
 {
     _graphics?.Draw(this, graphics, content, worldScale);
 }
コード例 #20
0
        public void Draw(ClientEntity entity, SpriteBatch graphics, BFBContentManager contentManager, float worldScale)
        {
            #region Draw Entity

            graphics.Draw(_animatedTexture.Texture,
                          entity.Position.ToVector2(),
                          _frameSelector,
                          _animatedTexture.ParsedColor,
                          entity.Rotation,
                          entity.Origin.ToVector2() - entity.Dimensions.ToVector2() / 2,
                          _animatedTexture.Scale * worldScale,
                          !_currentAnimationSet.Mirror ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
                          1);

            #endregion

            //Holding something?
            if (entity.Meta?.Holding?.AtlasKey == null)
            {
                return;
            }

            AtlasTexture atlas    = contentManager.GetAtlasTexture(entity.Meta.Holding.AtlasKey);
            float        rotation = 0;
            float        scale;
            int          x      = entity.Facing == DirectionFacing.Left ? entity.Left : entity.Right;
            int          y      = (int)(entity.Height / 1.5 + entity.Position.Y);
            Vector2      origin = new Vector2(atlas.Width / 2f, atlas.Height);

            if (System.Math.Abs(entity.Velocity.X) > 2)
            {
                if (entity.Facing == DirectionFacing.Left)
                {
                    rotation = (float)(-45 * (System.Math.PI / 180));
                    x       += 10;
                }
                else
                {
                    rotation = (float)(45 * (System.Math.PI / 180));
                    x       -= 10;
                }
                y = (int)(entity.Height / 2f + entity.Position.Y);
            }

            if (entity.Meta.Holding.ItemType == ItemType.Tool)
            {
                scale = worldScale;
            }
            else
            {
                scale = worldScale * 0.6f;
            }

            graphics.DrawAtlas(atlas, new Rectangle(x, y, (int)(atlas.Width * scale), (int)(atlas.Height * scale)), Color.White, rotation, origin);

            if (entity.Meta.Holding.ItemType == ItemType.Wall)
            {
                graphics.DrawAtlas(
                    atlas,
                    new Rectangle(x, y, (int)(atlas.Width * scale), (int)(atlas.Height * scale)),
                    new Color(0, 0, 0, 0.4f),
                    rotation, origin);
            }
        }
コード例 #21
0
 public AudioManager(BFBContentManager audio)
 {
     _content = audio;
 }
コード例 #22
0
        public void DebugDraw(SpriteBatch graphics, BFBContentManager content, float worldScale, float tileSize)
        {
            if (EntityType != EntityType.Particle)
            {
                int topBlockY    = (int)System.Math.Floor(Top / tileSize);
                int leftBlockX   = (int)System.Math.Floor(Left / tileSize);
                int bottomBlockY = (int)System.Math.Floor((Bottom - 1) / tileSize);
                int rightBlockX  = (int)System.Math.Floor((Right - 1) / tileSize);

                //left upper
                graphics.Draw(
                    content.GetTexture("default"),
                    new Rectangle(
                        (int)(leftBlockX * tileSize),
                        (int)(topBlockY * tileSize),
                        (int)tileSize,
                        (int)tileSize),
                    new Color(0, 100, 0, 0.2f));

                //left upper
                graphics.Draw(
                    content.GetTexture("default"),
                    new Rectangle(
                        (int)(leftBlockX * tileSize),
                        (int)(bottomBlockY * tileSize),
                        (int)tileSize,
                        (int)tileSize),
                    new Color(0, 100, 0, 0.2f));

                //right lower
                graphics.Draw(
                    content.GetTexture("default"),
                    new Rectangle(
                        (int)(rightBlockX * tileSize),
                        (int)(bottomBlockY * tileSize),
                        (int)tileSize,
                        (int)tileSize),
                    new Color(0, 100, 0, 0.2f));

                //right upper
                graphics.Draw(
                    content.GetTexture("default"),
                    new Rectangle(
                        (int)(rightBlockX * tileSize),
                        (int)(topBlockY * tileSize),
                        (int)tileSize,
                        (int)tileSize),
                    new Color(0, 100, 0, 0.2f));
            }
            //entity Bounds
            graphics.DrawBorder(
                new Rectangle((int)Position.X, (int)Position.Y, (int)Dimensions.X, (int)Dimensions.Y), 1,
                Color.Black, content.GetTexture("default"));

            Draw(graphics, content, worldScale);

            if (EntityType != EntityType.Particle)
            {
                //Position
                graphics.DrawBackedText($"X: {(int) Position.X}, Y: {(int) Position.Y}",
                                        new BfbVector(Position.X, Position.Y - 15), content, 0.2f * worldScale);
            }

            //velocity vector
            graphics.DrawVector(new Vector2(Position.X + Dimensions.X / 2, Position.Y + Dimensions.Y / 2), Velocity.ToVector2() * 4 * worldScale, 1, Color.Red, content);

            //orientation vector
            graphics.DrawLine(new Vector2(Position.X + Dimensions.X / 2, Position.Y + 10),
                              Facing == DirectionFacing.Left
                    ? new Vector2((Position.X + Dimensions.X / 2) + -30, Position.Y + 10)
                    : new Vector2((Position.X + Dimensions.X / 2) + 30, Position.Y + 10), 1, Color.Green, content);
        }
コード例 #23
0
 /// <summary>
 /// Optional Render method for rendering things on top of the ui
 /// </summary>
 /// <param name="graphics"></param>
 /// <param name="content"></param>
 public virtual void Draw(SpriteBatch graphics, BFBContentManager content)
 {
 }