Esempio n. 1
0
 protected override void OnPaint(PaintEventArgs e)
 {
     if (Transition != null && this.backgroundImage != null && this.ForegroundImage != null)
     {
         Transition.Draw(e.Graphics, this.ClientRectangle, this.backgroundImage, this.ForegroundImage);
     }
 }
Esempio n. 2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            _world.Draw(spriteBatch);

            spriteBatch.Begin();
            if (!Transition.HasEnded())
            {
                Transition.Draw(spriteBatch);
            }
            spriteBatch.End();
        }
Esempio n. 3
0
        public void Draw(SpriteBatch spriteBatch)
        {
            _activeScreen?.Draw(spriteBatch);

            spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp);
            _activeScreen?.UIManager?.Draw(spriteBatch);

            if (!_transition.HasEnded())
            {
                _transition.Draw(spriteBatch);
            }

            spriteBatch.End();
        }
Esempio n. 4
0
        /// <summary>
        /// draws the room and everything inside it
        /// </summary>
        /// <param name="spriteBatch">the sprite batch to draw to</param>
        public void Draw(SpriteBatch spriteBatch)
        {
            Vector2 ceiledOffset = new Vector2((float)(Math.Ceiling(Math.Abs(ViewPosition.X) * Math.Sign(ViewPosition.X))), (float)(Math.Ceiling(Math.Abs(ViewPosition.Y) * Math.Sign(ViewPosition.Y))));

            if (LightingEnabled)
            {
                spriteBatch.GraphicsDevice.SetRenderTarget(LightTarget);
                spriteBatch.GraphicsDevice.Clear(Color.Black);
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
                for (int i = 0; i < LightList.Count; i++)
                {
                    Light light = LightList[i];
                    light.Draw(spriteBatch, ceiledOffset);
                }
                spriteBatch.End();
            }
            spriteBatch.GraphicsDevice.SetRenderTarget(MainTarget);
            spriteBatch.GraphicsDevice.Clear(Color.LightGray);
            spriteBatch.Begin(SpriteSortMode.FrontToBack);
            Background?.Draw(spriteBatch, ceiledOffset);
            if (currentTransition != null && currentTransition.IsActive)
            {
                currentTransition.Draw(spriteBatch);
            }
            for (int i = 0; i < GameObjectList.Count; i++)
            {
                GameObjectList[i].Draw(spriteBatch, ceiledOffset);
            }
            for (int i = 0; i < GameTileList.Count; i++)
            {
                GameTileList[i].Draw(spriteBatch, ceiledOffset);
            }
            spriteBatch.End();
            spriteBatch.GraphicsDevice.SetRenderTarget(null);
            spriteBatch.GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            if (LightEffect != null && LightingEnabled)
            {
                LightEffect.Parameters["lightMask"].SetValue(LightTarget);
                LightEffect.CurrentTechnique.Passes[0].Apply();
            }
            spriteBatch.Draw(MainTarget, new Vector2(0, 0), Color.White);
            spriteBatch.End();
        }