Example #1
0
 public override void Draw()
 {
     if (visible)
     {
         SpriteDrawer.DrawGuiSprite(Texture, Position - offset, spriteRect, Z: DrawingUtilities.GetDrawingZ(layer));
     }
 }
Example #2
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));
            }
        }
Example #3
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;
            }
        }
        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);
            }
        }
Example #5
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));
            }
        }
Example #6
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));
            }
        }
Example #7
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);
                }
            }
        }
Example #8
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));
            }
        }
Example #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();
        }
Example #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));
            }
        }
Example #11
0
 public override void DrawUI()
 {
     base.DrawUI();
     SpriteDrawer.DrawGuiSprite(background, position, Z: DrawingUtilities.GetDrawingZ(DrawOrder.PAUSE_BG));
     title.Draw();
 }
Example #12
0
 public override void Draw()
 {
     SpriteDrawer.DrawGuiSprite(_box.Tex, _pos,
                                _box.GetRect((_turnedOn ? 1 : 0) + ((int)_style * 2)),
                                Z: DrawingUtilities.GetDrawingZ(_layer));
 }
 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);
 }