コード例 #1
0
ファイル: Game1.cs プロジェクト: Dinokaiz2/SteamholdFMS
 /// <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)
 {
     GraphicsDevice.SetRenderTarget(renderTarget);
     GraphicsDevice.Clear(new Color(0, 100, 0));
     spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
     spriteBatch.Draw(background, new Vector2(0, 0), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0);
     spriteBatch.Draw(logo, new Vector2(1200, 420), null, Color.White, 0, Vector2.Zero, 1.9f, SpriteEffects.None, 0);
     scoreCounter.Draw(spriteBatch);
     scoreCounter.DrawText(spriteBatch);
     outerWorks.Draw(spriteBatch);
     gearCounter.Draw(spriteBatch);
     endgameCounter.Draw(spriteBatch);
     rpCounter.Draw(spriteBatch);
     timer.Draw(spriteBatch);
     if (titleTextTop != "" || titleTextBottom != "")
     {
         DrawTitleTextSmall(titleTextTop, titleTextBottom);
     }
     else if (titleTextBig != "")
     {
         DrawTitleTextBig(titleTextBig);
     }
     shadowMap = (Texture2D)renderTarget;
     spriteBatch.End();
     GraphicsDevice.SetRenderTarget(null);
     spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
     shadowMap = (Texture2D)renderTarget;
     spriteBatch.End();
     GraphicsDevice.SetRenderTarget(null);
     spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, null);
     GraphicsDevice.Clear(Color.Green);
     if (GraphicsDevice.Adapter.CurrentDisplayMode.AspectRatio > 3840 / 2160)
     {
         spriteBatch.Draw(shadowMap, Vector2.Zero, null, Color.White, 0,
                          Vector2.Zero,
                          new Vector2(0.21f, 0.227f), SpriteEffects.None, 1);
     }
     else
     {
         spriteBatch.Draw(shadowMap, Vector2.Zero, null, Color.White, 0,
                          Vector2.Zero,
                          (float)GraphicsDevice.Adapter.CurrentDisplayMode.Width / 3840f, SpriteEffects.None, 1);
     }
     spriteBatch.End();
     base.Draw(gameTime);
 }