コード例 #1
0
ファイル: GameRunner.cs プロジェクト: osheroff/stardew-valley
 protected override void Draw(GameTime gameTime)
 {
     if (_windowSizeChanged)
     {
         ExecuteForInstances(delegate(Game1 instance)
         {
             instance.Window_ClientSizeChanged(null, null);
         });
         _windowSizeChanged = false;
         SubscribeClientSizeChange();
     }
     foreach (Game1 instance2 in gameInstances)
     {
         LoadInstance(instance2);
         Viewport old_viewport = base.GraphicsDevice.Viewport;
         Game1.graphics.GraphicsDevice.Viewport = new Viewport(0, 0, Math.Min(instance2.localMultiplayerWindow.Width, Game1.graphics.GraphicsDevice.PresentationParameters.BackBufferWidth), Math.Min(instance2.localMultiplayerWindow.Height, Game1.graphics.GraphicsDevice.PresentationParameters.BackBufferHeight));
         instance2.Instance_Draw(gameTime);
         base.GraphicsDevice.Viewport = old_viewport;
         SaveInstance(instance2);
     }
     if (LocalMultiplayer.IsLocalMultiplayer())
     {
         base.GraphicsDevice.Clear(Game1.bgColor);
         foreach (Game1 gameInstance in gameInstances)
         {
             gameInstance.isRenderingScreenBuffer = true;
             gameInstance.DrawSplitScreenWindow();
             gameInstance.isRenderingScreenBuffer = false;
         }
     }
     base.Draw(gameTime);
 }
コード例 #2
0
ファイル: GameRunner.cs プロジェクト: s-yi/StardewValley
 protected override void Draw(GameTime gameTime)
 {
     if (_windowSizeChanged)
     {
         ExecuteForInstances(delegate(Game1 instance)
         {
             instance.Window_ClientSizeChanged(null, null);
         });
         _windowSizeChanged = false;
         SubscribeClientSizeChange();
     }
     foreach (Game1 instance2 in gameInstances)
     {
         LoadInstance(instance2);
         Viewport old_viewport = base.GraphicsDevice.Viewport;
         Game1.graphics.GraphicsDevice.Viewport = new Viewport(0, 0, Math.Min(instance2.localMultiplayerWindow.Width, Game1.graphics.GraphicsDevice.PresentationParameters.BackBufferWidth), Math.Min(instance2.localMultiplayerWindow.Height, Game1.graphics.GraphicsDevice.PresentationParameters.BackBufferHeight));
         instance2.Instance_Draw(gameTime);
         base.GraphicsDevice.Viewport = old_viewport;
         SaveInstance(instance2);
     }
     if (LocalMultiplayer.IsLocalMultiplayer())
     {
         base.GraphicsDevice.Clear(Game1.bgColor);
         foreach (Game1 gameInstance in gameInstances)
         {
             Game1.isRenderingScreenBuffer = true;
             gameInstance.DrawSplitScreenWindow();
             Game1.isRenderingScreenBuffer = false;
         }
     }
     if (Game1.shouldDrawSafeAreaBounds)
     {
         SpriteBatch spriteBatch = Game1.spriteBatch;
         spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
         Rectangle safe_area = Game1.safeAreaBounds;
         spriteBatch.Draw(Game1.staminaRect, new Rectangle(safe_area.X, safe_area.Y, safe_area.Width, 2), Color.White);
         spriteBatch.Draw(Game1.staminaRect, new Rectangle(safe_area.X, safe_area.Y + safe_area.Height - 2, safe_area.Width, 2), Color.White);
         spriteBatch.Draw(Game1.staminaRect, new Rectangle(safe_area.X, safe_area.Y, 2, safe_area.Height), Color.White);
         spriteBatch.Draw(Game1.staminaRect, new Rectangle(safe_area.X + safe_area.Width - 2, safe_area.Y, 2, safe_area.Height), Color.White);
         spriteBatch.End();
     }
     base.Draw(gameTime);
 }