Exemplo n.º 1
0
        private void drawMainGame(GameTime gameTime, int shaderNum)
        {
            RenderTargetManager.setRenderTarget(RenderTargetManager.framePreRender);
            //background colour: Purple!
            GraphicsDevice.Clear(Color.Purple);
            //New updated real draw calls
            //which does not rely on spaghetti
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp);
            //the blocks are in the waaaaay back.
            //if buffered draw is used, they *must* be the first thing drawn.
            world.draw(spriteBatch);
            foreach (Particle particle in Particle.active)
            {
                particle.draw(spriteBatch);
            }

            //NPCs are behind the player
            foreach (NPC npc in NPC.Active)
            {
                npc.draw(spriteBatch);
            }
            //Due to immediate, draw back to front
            currentPlayer.draw(spriteBatch);
            //UI & projectiles are in front
            foreach (Projectile p in Projectile.active)
            {
                p.draw(spriteBatch);
            }
            //item draw
            foreach (ItemInWorld item in ItemInWorld.active)
            {
                item.draw(spriteBatch);
            }

            //UI over all.

            IGUI.draw();
            spriteBatch.End();
            RenderTargetManager.unsetRenderTarget();

            //draw the rendered scene to the screen.
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp);
            //Everything is shader!
            mainShader.CurrentTechnique.Passes[shaderNum].Apply();
            //Draw everything.
            spriteBatch.Draw(RenderTargetManager.framePreRender, zeroedWindow, Color.White);
            spriteBatch.End();
        }