Example #1
0
        protected override void Draw()
        {
            Camera.Update();

            if (LightsEnabled)
            {
                _krypton.Matrix = Camera.View;
                this._krypton.LightMapPrepare();
            }

            GraphicsDevice.Clear(new Color(240, 240, 240));

            _spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.View);

            foreach (var layer in Map.Layers.Where(p => p.Order <= ActiveLayer.Order).OrderBy(p => p.Order))
            {
                DrawLayer(layer);
            }

            _spriteBatch.End();

            if (LightsEnabled)
            {
                this._krypton.Draw();
            }

            _spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.View);

            ActiveTool.Draw(_spriteBatch, Camera, _currentMousePosition, _pixel);

            if (!mouseDown && _movingLight != null)
            {
                _movingLight = null;
            }

            foreach (Light2D light in _krypton.Lights)
            {
                if (light == SelectedLight)
                {
                    _spriteBatch.Draw(_selectionTexture, light.Position + new Vector2(1, -1), Color.White);
                }

                _spriteBatch.Draw(_lightSymbolTexture, light.Position /* - new Vector2(_lightSymbolTexture.Width / 2, _lightSymbolTexture.Height / 2)*/, Color.White);
            }

            _spriteBatch.End();
        }