Exemple #1
0
        public override void Draw(GameTime gameTime)
        {
            mainGame.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp,
                                       null, null, null, null);

            mainGame.spriteBatch.DrawString(AssetManager.MainFont, title, titlePosition,
                                            Color.White, 0, Vector2.Zero, titleScale, 0, 0);

            for (int i = 0; i < lstButton.Count; i++)
            {
                lstButton[i].Draw(mainGame.spriteBatch);
            }

            //Particle engine test
            particleEngine.Draw(gameTime);

            base.Draw(gameTime);
            mainGame.spriteBatch.End();
        }
Exemple #2
0
        public override void Draw(GameTime gameTime)
        {
            if (!mapSaving)
            {
                //Draw here all the game stuff whe will be altered by the lightShader
                mainGame.GraphicsDevice.SetRenderTargets(mainTarget);
                mainGame.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp,
                                           null, null, null, null);
                //map draw
                map.Draw(mainGame.spriteBatch);
                //ParticleEngine
                particleEngine.Draw(gameTime);
                //buildMode draw
                buildMode.Draw(mainGame.spriteBatch);
                //Draw scene
                base.Draw(gameTime);
                //CurrentMap
                if (mapManager.CurrentMap != null)
                {
                    mapManager.CurrentMap.Draw(mainGame.spriteBatch);
                }
                mainGame.spriteBatch.End();

                //SpellManager Got his own spriteBatch and his own Shader
                spellManager.Draw(mainGame.spriteBatch);

                //Draw Here Object who need to be layered
                mainGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp,
                                           null, null, null, null);
                //Enemie
                enemieManager.Draw(mainGame.spriteBatch);
                //Character
                myCharacter.Draw(mainGame.spriteBatch);
                mainGame.spriteBatch.End();

                if (shaderActivated)
                {
                    lightShaderManager.Draw(mainTarget, camera);                     //Shader
                }
                else
                {
                    mainGame.GraphicsDevice.SetRenderTarget(null);
                    mainGame.spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null,
                                               null, null, camera.Transform);
                    mainGame.spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White);
                    mainGame.spriteBatch.End();
                }

                //Draw GameObject who can't be modified by lightShader
                mainGame.spriteBatch.Begin(SpriteSortMode.Deferred, null, null,
                                           null, null, null, camera.Transform);
                enemieOutput.Draw(mainGame.spriteBatch);
                mainGame.spriteBatch.End();

                //Draw all the gui
                mainGame.spriteBatch.Begin();
                gameplayOutput.Draw(mainGame.spriteBatch);                 //GUI
                mainGame.spriteBatch.End();

                Fps_Count = Math.Floor(1.0f / (float)gameTime.ElapsedGameTime.TotalSeconds);
            }
        }