Beispiel #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            // background
            var sourceRectangle = new Rectangle(0, 0, _viewportAdapter.VirtualWidth, _viewportAdapter.VirtualHeight);

            sourceRectangle.Offset(_camera.Position * new Vector2(0.1f));

            _spriteBatch.Begin(samplerState: SamplerState.LinearWrap, transformMatrix: _viewportAdapter.GetScaleMatrix());
            _spriteBatch.Draw(_backgroundTexture, Vector2.Zero, sourceRectangle, Color.White);
            _spriteBatch.DrawString(_font, $"{_score}", Vector2.One, Color.White);
            _spriteBatch.End();

            // entities
            _spriteBatch.Begin(samplerState: SamplerState.LinearClamp, blendState: BlendState.AlphaBlend, transformMatrix: _camera.GetViewMatrix());
            _entityManager.Draw(_spriteBatch);
            _spriteBatch.End();

            _spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix());

            if (_player != null && _shieldHealth > 0)
            {
                _spriteBatch.DrawCircle(_player.Position, _shieldRadius, 32, Color.Green, _shieldHealth);
            }

            _spriteBatch.End();

            base.Draw(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, transformMatrix: currentCamera.GetViewMatrix());
            GraphicsDevice.Clear(Color.Black);

            switch (gameState)
            {
            case GameState.World:
                worldStateManager.Draw(spriteBatch);
                break;

            case GameState.Inventory:
                inventoryStateManager.Draw(spriteBatch);
                break;

            case GameState.InGameMenu:
                inGameMenuStateManager.Draw(spriteBatch);
                break;
            }
            cursorManager.Draw(spriteBatch);
            spriteBatch.End();
            base.Draw(gameTime);
        }
Beispiel #3
0
 protected override void Draw(GameTime gameTime)
 {
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, transformMatrix: camera.GetViewMatrix());
     GraphicsDevice.Clear(Color.Black);
     spriteBatch.DrawRectangle(new Rectangle(-10, -10, 20, 20), Color.Red);
     _worldManager.Draw(spriteBatch);
     playerManager.Draw(spriteBatch);
     _particleManager.Draw(spriteBatch);
     spriteBatch.End();
     base.Draw(gameTime);
 }
Beispiel #4
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            var sourceRectangle = new Rectangle(0, 0, _viewportAdapter.VirtualWidth, _viewportAdapter.VirtualHeight);

            sourceRectangle.Offset(_camera.Position);
            _spriteBatch.Begin(samplerState: SamplerState.LinearWrap, transformMatrix: _camera.GetViewMatrix());
            _spriteBatch.Draw(_backgroundTexture, _camera.Position, sourceRectangle, Color.White);
            _spriteBatch.End();

            _spriteBatch.Begin(samplerState: SamplerState.LinearClamp, transformMatrix: _camera.GetViewMatrix());
            _entityManager.Draw(_spriteBatch);
            _spriteBatch.End();

            base.Draw(gameTime);
        }