コード例 #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            //ResolutionUtility.toggleFullscreen();
            GraphicsDevice.Clear(Color.Red);
            GraphicsDevice.SetRenderTarget(gameRender);
            //   spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, SceneUtility.transform);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, null);
            if (!bRunEditMode && !StartScreen.bIsRunning || (StartScreen.bIsRunning && startScreen.bFinishedLoading))
            {
                scenes[SceneUtility.currentScene].Draw(gameTime, spriteBatch);

                TextUtility.Draw(spriteBatch, "Pre-alpha combat demo v0.1.6", defaultFont, new Rectangle(1000, 650, 300, 100), TextUtility.OutLining.Left, Color.Gold, 1f, false, default(Matrix), Color.Silver, false);
                //if ((int)Screens.Editor != SceneUtility.currentScene)
                //{
                //    CursorUtility.Draw(spriteBatch);
                //}
            }
            if (StartScreen.bIsRunning)
            {
                startScreen.Draw(spriteBatch, gameRender);
                spriteBatch.End();
                spriteBatch.GraphicsDevice.SetRenderTarget(gameRender);
                spriteBatch.GraphicsDevice.Clear(Color.TransparentBlack);
                spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null);

                if (!OptionsMenu.bIsRunning)
                {
                    spriteBatch.Draw(startScreen.getRender(), gameRender.Bounds, Color.White);
                }
                else
                {
                    spriteBatch.Draw(OptionsMenu.getRender(), gameRender.Bounds, Color.White);
                }
                BattleGUI.DrawCursor(spriteBatch, KeyboardMouseUtility.uiMousePos.ToVector2(), 1f);

                TextUtility.Draw(spriteBatch, "Pre-alpha combat demo v0.1.6", defaultFont, new Rectangle(1000, 650, 300, 100), TextUtility.OutLining.Left, Color.Gold, 1f, false, default(Matrix), Color.Silver, false);

                spriteBatch.End();
            }

            spriteBatch.End();

            //if (bRunEditMode)
            //{
            //    ScripTestingScene.Draw(spriteBatch);
            //}
            //ResolutionUtility.toggleFullscreen();
            GraphicsDevice.SetRenderTarget(null);
            Matrix m = Matrix.CreateTranslation(0, 0, 1) * Matrix.CreateScale(ResolutionUtility.stdScale.X, ResolutionUtility.stdScale.Y, 1);

            m.M11 = 1.0f;
            m.M22 = 1.0f;
            if (graphics.IsFullScreen)
            {
                Rectangle targetDrawInFullScreen = new Rectangle(((int)monitorSize.X - (int)ResolutionUtility.WindowSizeBeforeFullScreen.X) / 2, ((int)monitorSize.Y - (int)ResolutionUtility.WindowSizeBeforeFullScreen.Y) / 2, (int)ResolutionUtility.WindowSizeBeforeFullScreen.X, (int)ResolutionUtility.WindowSizeBeforeFullScreen.Y);
                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null);
                // spriteBatch.Draw(gameRender, targetDrawInFullScreen, gameRender.Bounds, Color.White);
                spriteBatch.Draw(gameRender, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
                spriteBatch.End();

                //spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, SceneUtility.transform);
                //spriteBatch.Draw(gameRender, new Rectangle(0,0,1366,768), Color.White);
                //spriteBatch.End();

                //spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, null);
                //spriteBatch.Draw(gameRender, gameRender.Bounds, Color.White);
                //spriteBatch.End();
            }
            else
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null);
                // spriteBatch.Draw(gameRender, gameRender.Bounds, Color.White);
                // Rectangle targetDrawInFullScreen = new Rectangle(((int)monitorSize.X - (int)ResolutionUtility.WindowSizeBeforeFullScreen.X) / 2, ((int)monitorSize.Y - (int)ResolutionUtility.WindowSizeBeforeFullScreen.Y) / 2, (int)ResolutionUtility.WindowSizeBeforeFullScreen.X, (int)ResolutionUtility.WindowSizeBeforeFullScreen.Y);
                spriteBatch.Draw(gameRender, new Rectangle(0, 0, (int)ResolutionUtility.WindowSizeBeforeFullScreen.X, (int)ResolutionUtility.WindowSizeBeforeFullScreen.Y), Color.White);
                spriteBatch.End();
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }