示例#1
0
        /// <summary>
        /// Called to actually render the game content to the backbuffer, which will be flipped with
        /// the currently displayed buffer to show the next frame.
        /// </summary>
        /// <param name="gameTime">Current time information of the application</param>
        protected override void Draw(GameTime gameTime)
        {
            cGraphDevMgr.GraphicsDevice.Clear(Color.Black);

            cDrawBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);

            cShowingLbl.Draw(cDrawBatch);
            cSettingsCont.Draw(cDrawBatch);
            cAddParitclesBtn.Draw(cDrawBatch);
            cNumParticlesLbl.Draw(cDrawBatch);
            cNumParticlesTxt.Draw(cDrawBatch);
            cHeightLbl.Draw(cDrawBatch);
            cHeightMinTxt.Draw(cDrawBatch);
            cHeightMaxTxt.Draw(cDrawBatch);
            cWidthLbl.Draw(cDrawBatch);
            cWidthMinTxt.Draw(cDrawBatch);
            cWidthMaxTxt.Draw(cDrawBatch);
            cRedLbl.Draw(cDrawBatch);
            cRedMinTxt.Draw(cDrawBatch);
            cRedMaxTxt.Draw(cDrawBatch);
            cGreenLbl.Draw(cDrawBatch);
            cGreenMinTxt.Draw(cDrawBatch);
            cGreenMaxTxt.Draw(cDrawBatch);
            cBlueLbl.Draw(cDrawBatch);
            cBlueMinTxt.Draw(cDrawBatch);
            cBlueMaxTxt.Draw(cDrawBatch);
            cLifeLbl.Draw(cDrawBatch);
            cLifeMinTxt.Draw(cDrawBatch);
            cLifeMaxTxt.Draw(cDrawBatch);
            cDelayLbl.Draw(cDrawBatch);
            cDelayMinTxt.Draw(cDrawBatch);
            cDelayMaxTxt.Draw(cDrawBatch);
            cXDistLbl.Draw(cDrawBatch);
            cXDistMinTxt.Draw(cDrawBatch);
            cXDistMaxTxt.Draw(cDrawBatch);
            cYDistLbl.Draw(cDrawBatch);
            cYDistMinTxt.Draw(cDrawBatch);
            cYDistMaxTxt.Draw(cDrawBatch);
            cRotateLbl.Draw(cDrawBatch);
            cRotateMinTxt.Draw(cDrawBatch);
            cRotateMaxTxt.Draw(cDrawBatch);
            cRotateAfterBtn.Draw(cDrawBatch);
            cAlphaFadeBtn.Draw(cDrawBatch);

            cSparkles.Draw(cDrawBatch);

            //Always draw console last
            cDevConsole.Draw(cDrawBatch);

            cDrawBatch.End();

            //Use monogame draw
            base.Draw(gameTime);
        }
示例#2
0
 public override void Draw(GameTime gameTime)
 {
     _particleEngine.Draw();
 }
示例#3
0
        protected override void Draw(GameTime gameTime)
        {
            Rectangle OverlayRect;
            Vector2   OverlayOrigin;

            cGraphDevMgr.GraphicsDevice.Clear(Color.Black);

            cUFOs.Draw();
            cAsteroids.Draw();
            cEnemyBullets.Draw();
            cPlayerBullets.Draw();

            if (cHeadlightMode == true)              //Dimming overlay for the flashlight
            {
                cDrawBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);

                OverlayRect.X      = cPlayerShip.Left + (cPlayerShip.Width / 2);
                OverlayRect.Y      = cPlayerShip.Top + (cPlayerShip.Height / 2);
                OverlayRect.Width  = cTextureDict[Textures.LightFilter].Width * 4 + cGraphDevMgr.GraphicsDevice.Viewport.Width;
                OverlayRect.Height = cTextureDict[Textures.LightFilter].Height * 4 + cGraphDevMgr.GraphicsDevice.Viewport.Height;

                OverlayOrigin.X = cTextureDict[Textures.LightFilter].Width / 2;
                OverlayOrigin.Y = cTextureDict[Textures.LightFilter].Height;

                //cDrawBatch.Draw(cSolidTexture, cGraphDevMgr.GraphicsDevice.Viewport.Bounds, cSolidTexture.Bounds, new Color(255, 0, 0, 255));
                cDrawBatch.Draw(cTextureDict[Textures.LightFilter], OverlayRect, cTextureDict[Textures.LightFilter].Bounds, new Color(255, 200, 255, 250), (float)((Math.PI * 2) - (cPlayerShip.cRotation)), OverlayOrigin, SpriteEffects.None, 0);
                cDrawBatch.Draw(cTextureDict[Textures.LightFilter], OverlayRect, cTextureDict[Textures.LightFilter].Bounds, new Color(255, 200, 255, 250), (float)((Math.PI * 2) - (cPlayerShip.cRotation + Math.PI)), OverlayOrigin, SpriteEffects.FlipHorizontally, 0);

                cDrawBatch.End();
            }

            cPlayerShip.Draw();
            cSparkles.Draw();

            cDevConsole.Draw();

            if (cShowStats == true)
            {
                cDrawBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
                cFont.WriteText(cDrawBatch, string.Format("Asteroids={0} UFOs={1} Bullets={2} Sparkles={3} Kills={4} Max={5} Alive={6:0.00}s", cAsteroids.ParticleList.Count, cUFOs.ParticleList.Count, cPlayerBullets.ParticleList.Count + cEnemyBullets.ParticleList.Count, cSparkles.ParticleList.Count, cEnemyKills, cEnemyKillsMax, gameTime.TotalGameTime.TotalSeconds - cAliveSince), 10, cGraphDevMgr.GraphicsDevice.Viewport.Height - cFont.CharacterHeight, 10, Color.Azure);
                cDrawBatch.End();
            }

            /*
             * Vector2 ShadowOrigin = MGTools.MGMath.CalculateXYMagnitude(cPlayerShip.cRotation, cPlayerShip.Height);
             * Matrix StencilMatrix = Matrix.CreateOrthographicOffCenter(0, cGraphDevMgr.GraphicsDevice.PresentationParameters.BackBufferWidth, cGraphDevMgr.GraphicsDevice.PresentationParameters.BackBufferHeight, 0, 0, 1);
             *
             * var StencilAlphaTest = new AlphaTestEffect(cGraphDevMgr.GraphicsDevice);
             * StencilAlphaTest.Projection = StencilMatrix;
             *
             * DepthStencilState DepthStencilMask = new DepthStencilState();
             * DepthStencilMask.StencilEnable = true;
             * DepthStencilMask.StencilFunction = CompareFunction.Always;
             * DepthStencilMask.StencilPass = StencilOperation.Replace;
             * DepthStencilMask.ReferenceStencil = 1;
             * DepthStencilMask.DepthBufferEnable = false;
             *
             * DepthStencilState DepthStencilDraw = new DepthStencilState {
             *      StencilEnable = true,
             *      StencilFunction = CompareFunction.LessEqual,
             *      StencilPass = StencilOperation.Keep,
             *      ReferenceStencil = 1,
             *      DepthBufferEnable = false,
             * };
             *
             * cDrawBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, DepthStencilMask, null, StencilAlphaTest);
             * cDrawBatch.Draw(cSolidTexture, new Rectangle((int)(cPlayerShip.Left + (cPlayerShip.Width / 2) - ShadowOrigin.X), (int)(cPlayerShip.Top + (cPlayerShip.Height / 2) + ShadowOrigin.Y), cGraphDevMgr.GraphicsDevice.Viewport.Width * 2, cGraphDevMgr.GraphicsDevice.Viewport.Height * 2), cSolidTexture.Bounds, new Color(0,0,0,0), (float)(2 * Math.PI - cPlayerShip.cRotation + 1.0472), Vector2.Zero, SpriteEffects.None, 0);
             * cDrawBatch.Draw(cSolidTexture, new Rectangle((int)(cPlayerShip.Left + (cPlayerShip.Width / 2) - ShadowOrigin.X), (int)(cPlayerShip.Top + (cPlayerShip.Height / 2) + ShadowOrigin.Y), cGraphDevMgr.GraphicsDevice.Viewport.Width * 2, cGraphDevMgr.GraphicsDevice.Viewport.Height * 2), cSolidTexture.Bounds, new Color(0,0,0,0), (float)(2 * Math.PI - cPlayerShip.cRotation - 2.618), Vector2.Zero, SpriteEffects.None, 0);
             * cDrawBatch.Draw(cSolidTexture, new Rectangle((int)(cPlayerShip.Left + (cPlayerShip.Width / 2) - ShadowOrigin.X), (int)(cPlayerShip.Top + (cPlayerShip.Height / 2) + ShadowOrigin.Y), cGraphDevMgr.GraphicsDevice.Viewport.Width * 2, cGraphDevMgr.GraphicsDevice.Viewport.Height * 2), cSolidTexture.Bounds, new Color(0,0,0,0), (float)(2 * Math.PI - cPlayerShip.cRotation + (Math.PI / 2)), Vector2.Zero, SpriteEffects.None, 0);
             * cDrawBatch.Draw(cSolidTexture, new Rectangle((int)(cPlayerShip.Left + (cPlayerShip.Width / 2) - ShadowOrigin.X), (int)(cPlayerShip.Top + (cPlayerShip.Height / 2) + ShadowOrigin.Y), cGraphDevMgr.GraphicsDevice.Viewport.Width * 2, cGraphDevMgr.GraphicsDevice.Viewport.Height * 2), cSolidTexture.Bounds, new Color(0,0,0,0), (float)(2 * Math.PI - cPlayerShip.cRotation + Math.PI), Vector2.Zero, SpriteEffects.None, 0);
             * cDrawBatch.End();
             *
             * cDrawBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilDraw, null, StencilAlphaTest); //Draw stuff to be masked
             * cDrawBatch.Draw(cTextureDict[Textures.Asteroid], cGraphDevMgr.GraphicsDevice.Viewport.Bounds, new Color(0, 0, 0, 100)); //Uses
             * cDrawBatch.End();
             */
            //Use monogame draw
            base.Draw(gameTime);
        }