Exemplo n.º 1
0
 // Draw hitBox
 public void DrawHitBox(SpriteBatch spriteBatch)
 {
     if (GetComponent <HitBox>().HitBoxCollider is BoxCollider col)
     {
         ShapeRenderer.DrawRectangle(spriteBatch, Position + col.Offset, col.Size, Color.Azure);
     }
 }
Exemplo n.º 2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            var renderStatistics = RenderStatistics.Instance;

            const int spacing       = 5;
            var       elementHeight = _debugSpriteFont.LineSpacing + spacing;
            var       height        = elementHeight * 4 + spacing;
            const int width         = 180;

            var startPosition = new Vector2(0, GameInstance.ScreenBounds.Height - height);

            _shapeRenderer.DrawRectangle((int)startPosition.X,
                                         (int)startPosition.Y,
                                         width,
                                         height,
                                         Color.DarkGreen);

            startPosition.X += spacing;
            startPosition.Y += spacing;
            spriteBatch.DrawString(_debugSpriteFont, $"Average DrawTime[ms]: {renderStatistics.AverageDrawTime:0.00}", startPosition, Color.White);
            startPosition.Y += elementHeight;
            spriteBatch.DrawString(_debugSpriteFont, $"Total Drawcalls: {renderStatistics.DrawCalls}", startPosition, Color.White);
            startPosition.Y += elementHeight;
            spriteBatch.DrawString(_debugSpriteFont, $"Entity Count: {_world.EntitySystem.EntityCount}", startPosition, Color.White);
            startPosition.Y += elementHeight;
            spriteBatch.DrawString(_debugSpriteFont, $"Mesh Instances: {Rendering.Data.Mesh.InstanceCount}", startPosition, Color.White);
        }
Exemplo n.º 3
0
        internal override void Draw(GameTime gameTime)
        {
            ShapeRenderer.DrawRectangle(_backgroundColor, ClientAreaRectangle);
            ShapeRenderer.DrawBorder(Focused ? _borderColorFocused : _borderColorUnfocused, ClientAreaRectangle, BORDER_WIDTH);

            SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, _scissorState);

            Rectangle preScissor = GraphicsDevice.ScissorRectangle;

            GraphicsDevice.ScissorRectangle = _scissorRectangle;

            SpriteBatch.DrawString(ContentLibrary.UIFont_Small, _text, AbsoluteClientAreaPosition + new Vector2(2 - _currentOffset, (Height - ContentLibrary.UIFont_Small.LineSpacing) / 2f), TextColor);

            if (Focused)
            {
                if (Environment.TickCount - _lastSwitchCaretVisibility >= 500 || _forceCaretVisible)
                {
                    _lastSwitchCaretVisibility = Environment.TickCount;
                    _showCaret = !_showCaret || _forceCaretVisible;
                }

                if (_showCaret)
                {
                    SpriteBatch.Draw(ContentLibrary.DummyTexture, new Rectangle((int)_caretPosition.X, (int)_caretPosition.Y, 1, ContentLibrary.UIFont_Small.LineSpacing), _textColor);
                }
            }

            GraphicsDevice.ScissorRectangle = preScissor;

            SpriteBatch.End();
        }
Exemplo n.º 4
0
        internal override void Draw(GameTime gameTime)
        {
            ShapeRenderer.DrawRectangle(Focused ? _backgroundFocused : _backgroundUnfocused, ControlRectangle);

            for (int i = 0; i < ChildControls.Count; i++)
            {
                ChildControls[i].Draw(gameTime);
            }
        }
Exemplo n.º 5
0
        public void Draw(TextRenderer textRenderer, ShapeRenderer shapeRenderer)
        {
            if (this.renderedAlpha > 0)
            {
                var colour = this.Colour;
                colour.A = this.renderedAlpha;

                shapeRenderer.DrawRectangle(this.Size, this.Position, colour);
            }
        }
Exemplo n.º 6
0
        internal override void Draw(GameTime gameTime)
        {
            if (_renderBackgroundTexture != null)
            {
                ShapeRenderer.DrawRectangle(_renderBackgroundTexture, ClientAreaRectangle, _renderBackgroundColor);
            }

            for (int i = 0; i < ChildControls.Count; i++)
            {
                ChildControls[i].Draw(gameTime);
            }

            ShapeRenderer.DrawBorder(Focused ? _borderColorFocused : _borderColorUnfocused, ClientAreaRectangle, BORDER_WIDTH);
        }
Exemplo n.º 7
0
        internal override void Draw(GameTime gameTime)
        {
            if (_renderBackgroundTexture != null)
            {
                ShapeRenderer.DrawRectangle(_renderBackgroundTexture, ClientAreaRectangle, _renderBackgroundColor);
            }

            for (int i = 0; i < _tabPages.Count; i++)
            {
                _tabPages[i].Button.Draw(gameTime);
            }

            if (CurrentPanel != null)
            {
                CurrentPanel.Draw(gameTime);
            }

            ShapeRenderer.DrawBorder(Focused ? _borderColorFocused : _borderColorUnfocused, ClientAreaRectangle, BORDER_WIDTH);
        }
Exemplo n.º 8
0
        public override void Draw(object dc, ShapeRenderer renderer, double dx, double dy, object db, object r)
        {
            var state = base.BeginTransform(dc, renderer);

            if (Style != null)
            {
                renderer.DrawRectangle(dc, this, Style, dx, dy);
            }

            if (renderer.Selected.Contains(TopLeft))
            {
                TopLeft.Draw(dc, renderer, dx, dy, db, r);
            }

            if (renderer.Selected.Contains(BottomRight))
            {
                BottomRight.Draw(dc, renderer, dx, dy, db, r);
            }

            base.Draw(dc, renderer, dx, dy, db, r);
            base.EndTransform(dc, renderer, state);
        }
Exemplo n.º 9
0
        internal override void Draw(GameTime gameTime)
        {
            if (_renderBackgroundTexture != null)
            {
                ShapeRenderer.DrawRectangle(_renderBackgroundTexture, ControlRectangle, _renderBackgroundColor);
            }

            if (Focused)
            {
                ShapeRenderer.DrawBorder(_borderColorFocused, ClientAreaRectangle, BORDER_WIDTH);
            }

            Vector2 dim = _renderSpriteFont.MeasureString(_text);

            SpriteBatch.Begin();

            Point center = ClientAreaRectangle.Center;

            SpriteBatch.DrawString(_renderSpriteFont, _text, new Vector2(center.X - dim.X / 2f, center.Y - dim.Y / 2f), _renderTextColor);

            SpriteBatch.End();
        }
Exemplo n.º 10
0
 // Test draw (only testeroni thing)
 public void Draw(SpriteBatch spriteBatch)
 {
     ShapeRenderer.DrawRectangle(spriteBatch, Position, Size, Color.Red, 1);
 }