예제 #1
0
 public virtual void Draw()
 {
     if (exists)
     {
         if (visible)
         {
             Rectangle srect = sprite.GetRect(_curAnim.Frame);
             srect.Height -= (int)y_push;
             SpriteDrawer.DrawSprite(sprite.Tex,
                                     MathUtilities.CreateRectangle(Position.X - offset.X * scale, Position.Y - offset.Y * scale + (int)y_push, srect.Width * scale, srect.Height * scale),
                                     srect,
                                     color * opacity,
                                     rotation,
                                     _flip,
                                     DrawingUtilities.GetDrawingZ(layer, MapUtilities.GetInGridPosition(Position).Y + height));
         }
         if (shadow != null)
         {
             shadow.Draw();
         }
         if (GlobalState.draw_hitboxes && HasVisibleHitbox)
         {
             SpriteDrawer.DrawSprite(ResourceManager.GetTexture("hitbox"), Hitbox, color: Color.Red, Z: DrawingUtilities.GetDrawingZ(DrawOrder.HITBOX, 0));
         }
     }
 }
예제 #2
0
        public void Draw()
        {
            float z        = DrawingUtilities.GetDrawingZ(drawLayer);
            float shadowZ  = z - 0.01f;
            float currentY = firstLineY;

            foreach (List <TextCharacter> line in characterLines)
            {
                foreach (var c in line)
                {
                    if (c.Character == null)
                    {
                        SpriteDrawer.DrawGuiSprite(buttonSprite, WriteAreaTopLeft + new Vector2(c.X, currentY - GameConstants.BUTTON_HEIGHT / 4), c.Crop, Z: z);
                    }
                    else
                    {
                        SpriteDrawer.DrawGuiSprite(spriteFont.texture, WriteAreaTopLeft + new Vector2(c.X, currentY), c.Crop, spriteFont.color * Opacity, Z: z);
                        if (DrawShadow)
                        {
                            SpriteDrawer.DrawGuiSprite(spriteFont.texture, WriteAreaTopLeft + new Vector2(c.X, currentY + 1), c.Crop, color: Color.Black * Opacity, Z: shadowZ);
                        }
                    }
                }
                currentY += spriteFont.lineSeparation;
            }
        }
예제 #3
0
        public override void Draw()
        {
            base.Draw();

            float z     = DrawingUtilities.GetDrawingZ(layer);
            float max_z = DrawingUtilities.GetDrawingZ(layer + 1);

            SpriteDrawer.DrawGuiSprite(_sliderBg, new Rectangle(
                                           (int)(position.X + BarOffset - _slider.Width / 2),
                                           (int)(position.Y - _slider.Height / 2),
                                           (int)(_slider.Width),
                                           (int)(_slider.Height)),
                                       Z: z);


            SpriteDrawer.DrawGuiSprite(_slider.Tex, position + new Vector2(BarOffset, 0), _slider.GetRect((int)_style), Z: z + 2 * (max_z - z) / 3);

            if (current > min)
            {
                int width = (int)(_slider.Width * (current - min) / (max - min));

                SpriteDrawer.DrawGuiSprite(_sliderInside, new Rectangle(
                                               (int)(position.X + BarOffset - width / 2),
                                               (int)(position.Y - _slider.Height / 2),
                                               (int)(width),
                                               (int)(_slider.Height)),
                                           Z: z + (max_z - z) / 3);
            }
        }
예제 #4
0
        public void DrawUI()
        {
            Writer.Draw();
            SpriteDrawer.DrawGuiSprite(_boxTexture, pos, Z: DrawingUtilities.GetDrawingZ(DrawOrder.TEXTBOX));

            if (_drawBlinky)
            {
                SpriteDrawer.DrawGuiSprite(blinky_box, _blinkyPos, Z: DrawingUtilities.GetDrawingZ(DrawOrder.TEXT));
            }
        }
예제 #5
0
        public void Draw()
        {
            float z       = DrawingUtilities.GetDrawingZ(drawLayer);
            float shadowZ = z - 0.01f;

            foreach (var c in characters)
            {
                SpriteDrawer.DrawGuiSprite(spriteFont.texture, c.Position, c.Crop, spriteFont.color, Z: z);
                if (DrawShadow)
                {
                    SpriteDrawer.DrawGuiSprite(spriteFont.texture, c.Position + new Vector2(0, 1f), c.Crop, color: Color.Black, Z: shadowZ);
                }
            }
        }
예제 #6
0
        public override void Draw()
        {
            if (visible)
            {
                Rectangle srect = sprite.GetRect(_curAnim.Frame);

                SpriteDrawer.DrawGuiSprite(sprite.Tex,
                                           MathUtilities.CreateRectangle(Position.X - offset.X * scale, Position.Y - offset.Y * scale + (int)y_push, srect.Width * scale, srect.Height * scale),
                                           srect,
                                           color * opacity,
                                           rotation,
                                           Z: DrawingUtilities.GetDrawingZ(layer));
            }
        }
예제 #7
0
        public virtual void Draw()
        {
            if (visible && exists)
            {
                SpriteDrawer.DrawSprite(Texture,
                                        MathUtilities.CreateRectangle(Position.X - offset.X * scale, Position.Y - offset.Y * scale, frameWidth * scale, frameHeight * scale),
                                        spriteRect,
                                        Color.White * _opacity,
                                        rotation,
                                        _flip,
                                        DrawingUtilities.GetDrawingZ(layer, MapUtilities.GetInGridPosition(Position).Y));

                if (shadow != null)
                {
                    shadow.Draw();
                }
            }
        }
예제 #8
0
        public void Draw(bool ignoreEmpty = false)
        {
            float z = DrawingUtilities.GetDrawingZ(_layer);

            for (int y = 0; y < heightInTiles; y++)
            {
                for (int x = 0; x < widthInTiles; x++)
                {
                    Rectangle?rect = _rects[x + y * widthInTiles];

                    if (rect.HasValue)
                    {
                        int tile = data[x + y * widthInTiles];

                        if (!ignoreEmpty || tile != 0)
                        {
                            SpriteDrawer.DrawSprite(tiles, new Rectangle(x * _tileWidth, y * _tileHeight, _tileWidth, _tileHeight), rect.Value, Z: z);
                        }
                    }
                }
            }
        }
예제 #9
0
        public override void DrawUI()
        {
            SpriteDrawer.DrawGuiSprite(_header, Vector2.Zero, Z: DrawingUtilities.GetDrawingZ(DrawOrder.HEADER));


            if (InventoryManager.EquippedBroom != BroomType.NONE && _equippedBroomIcon != null)
            {
                SpriteDrawer.DrawGuiSprite(_equippedBroomIcon, _iconPos, Z: DrawingUtilities.GetDrawingZ(DrawOrder.UI_OBJECTS));
            }

            SpriteDrawer.DrawGuiSprite(_equippedBroomBorder, _iconPos, Z: DrawingUtilities.GetDrawingZ(DrawOrder.EQUIPPED_BORDER));


            _healthBar.Draw();

            if (_childState != null)
            {
                _childState.DrawUI();
            }


            _keyValueLabel.Draw();
        }
예제 #10
0
        public override void DrawUI()
        {
            base.DrawUI();

            SpriteDrawer.DrawGuiSprite(_sliderBg, new Rectangle(
                                           (int)((position.X + BarOffset)),
                                           (int)(position.Y),
                                           (int)(_slider.Width),
                                           (int)(_slider.Height)),
                                       Z: DrawingUtilities.GetDrawingZ(DrawOrder.AUDIO_SLIDER_BG));


            SpriteDrawer.DrawGuiSprite(_slider, position + new Vector2(BarOffset, 0), Z: DrawingUtilities.GetDrawingZ(DrawOrder.AUDIO_SLIDER));

            if (current > min)
            {
                SpriteDrawer.DrawGuiSprite(_sliderInside, new Rectangle(
                                               (int)((position.X + BarOffset)),
                                               (int)(position.Y),
                                               (int)(_slider.Width * (current - min) / (max - min)),
                                               (int)(_slider.Height)),
                                           Z: DrawingUtilities.GetDrawingZ(DrawOrder.AUDIO_SLIDER_BAR));
            }
        }
예제 #11
0
 public override void Draw()
 {
     if (visible)
     {
         SpriteDrawer.DrawGuiSprite(Texture, Position - offset, spriteRect, Z: DrawingUtilities.GetDrawingZ(layer));
     }
 }
예제 #12
0
 public FG_Blend()
 {
     cutoff = DrawingUtilities.GetDrawingZ(DrawOrder.FG_SPRITES, 0);
 }
예제 #13
0
 public override void DrawUI()
 {
     base.DrawUI();
     SpriteDrawer.DrawGuiSprite(background, position, Z: DrawingUtilities.GetDrawingZ(DrawOrder.PAUSE_BG));
     title.Draw();
 }
예제 #14
0
        public override void Draw()
        {
            if (visible && exists)
            {
                float draw_y = MapUtilities.GetInGridPosition(Position).Y;
                if (!is_behind_player)
                {
                    float player_y = MapUtilities.GetInGridPosition(_root.Position).Y + _root.height;
                    draw_y = player_y + 0.5f;
                }
                SpriteDrawer.DrawSprite(sprite.Tex, MathUtilities.CreateRectangle(Position.X - offset.X, Position.Y - offset.Y, sprite.Width, sprite.Height), sprite.GetRect(_curAnim.Frame), rotation: rotation, Z: DrawingUtilities.GetDrawingZ(layer, draw_y));

                wide_attack.Draw();
                long_attack.Draw();

                //Draw hitbox, but not yourself
                visible = false;
                base.Draw();
                visible = true;
            }
        }
예제 #15
0
 public override void Draw()
 {
     SpriteDrawer.DrawGuiSprite(_box.Tex, _pos,
                                _box.GetRect((_turnedOn ? 1 : 0) + ((int)_style * 2)),
                                Z: DrawingUtilities.GetDrawingZ(_layer));
 }
예제 #16
0
        public override void Draw()
        {
            if (visible && exists)
            {
                float draw_y = MapUtilities.GetInGridPosition(Position).Y;
                if (!is_behind_player)
                {
                    float player_y = MapUtilities.GetInGridPosition(_root.Position).Y;
                    draw_y = player_y + 0.5f;
                }
                SpriteDrawer.DrawSprite(Texture, MathUtilities.CreateRectangle(Position.X - offset.X, Position.Y - offset.Y, frameWidth, frameHeight), spriteRect, rotation: rotation, Z: DrawingUtilities.GetDrawingZ(layer, draw_y));

                wide_attack.Draw();
                long_attack.Draw();
            }
        }
예제 #17
0
        public override void Draw()
        {
            base.Draw();

            _label.Draw();

            if (equipped)
            {
                SpriteDrawer.DrawGuiSprite(_equipIcon, Position + new Vector2(12, -1), Z: DrawingUtilities.GetDrawingZ(DrawOrder.EQUIPPED_ICON));
            }
        }
예제 #18
0
 public void Draw()
 {
     SpriteDrawer.DrawGuiSprite(fadeIn, Vector2.Zero, new Rectangle(0, 0, GameConstants.SCREEN_WIDTH_IN_PIXELS, GameConstants.SCREEN_HEIGHT_IN_PIXELS + GameConstants.HEADER_HEIGHT), Z: DrawingUtilities.GetDrawingZ(DrawOrder.DEATH_FADEIN), color: color * Opacity);
 }
예제 #19
0
        /// <param name="sprites">Spritesheet to use when drawing</param>
        /// <param name="topleft">Top left coordinate of the 0,0 tile</param>
        /// <param name="bounds">Part of the minimap to draw</param>
        public void Draw(Spritesheet sprites, Vector2 topleft, Rectangle?bounds = null, bool DrawPlayerIndicator = true)
        {
            Rectangle b = bounds ?? new Rectangle(0, 0, tiles.Width, tiles.Height);

            for (int y = b.Top; y < b.Bottom; ++y)
            {
                for (int x = b.Left; x < b.Right; ++x)
                {
                    Vector2 pos     = topleft + new Vector2(x * sprites.Width, y * sprites.Height);
                    int     visible = interest[x + y * tiles.Width];
                    if (visible > 0)
                    {
                        SpriteDrawer.DrawGuiSprite(sprites.Tex, pos, sprites.GetRect(tiles.GetTile(new(x, y))), Z: DrawingUtilities.GetDrawingZ(DrawOrder.MINIMAP));
                    }
                    if (visible > 1)
                    {
                        SpriteDrawer.DrawGuiSprite(sprites.Tex, pos, sprites.GetRect(ChestIndicator), Z: DrawingUtilities.GetDrawingZ(DrawOrder.MINIMAP_CHEST));
                    }
                }
            }

            Vector2 PlayerPos = new Vector2(GlobalState.CURRENT_GRID_X, GlobalState.CURRENT_GRID_Y);

            if (b.Contains(PlayerPos) && DrawPlayerIndicator)
            {
                SpriteDrawer.DrawGuiSprite(sprites.Tex, topleft + PlayerPos * new Vector2(sprites.Width), sprites.GetRect(PlayerIndicator), Z: DrawingUtilities.GetDrawingZ(DrawOrder.MINIMAP_PLAYER));
            }
        }