diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-19 01:02:07 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-19 01:02:07 -0500 |
commit | b2efd34fec00a952cd7d2ebdc02a2c2be506380e (patch) | |
tree | a5841e829288dd6958fa1d1422b37090fd21da12 /src/StardewModdingAPI/Framework | |
parent | e321362378eaacd0081db44f0db3ef457ef97368 (diff) | |
download | SMAPI-b2efd34fec00a952cd7d2ebdc02a2c2be506380e.tar.gz SMAPI-b2efd34fec00a952cd7d2ebdc02a2c2be506380e.tar.bz2 SMAPI-b2efd34fec00a952cd7d2ebdc02a2c2be506380e.zip |
fix on-post-render graphics event being raised after screen is rendered
This causes mods to draw on top of the rendered screen instead of within it, which leads to strange bugs like cursor coordinates not lining up with the cursor and transparency issues.
Diffstat (limited to 'src/StardewModdingAPI/Framework')
-rw-r--r-- | src/StardewModdingAPI/Framework/SGame.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs index baf74fd4..f64457f8 100644 --- a/src/StardewModdingAPI/Framework/SGame.cs +++ b/src/StardewModdingAPI/Framework/SGame.cs @@ -987,13 +987,20 @@ namespace StardewModdingAPI.Framework Game1.overlayMenu.draw(Game1.spriteBatch); Game1.spriteBatch.End(); } + + if (GraphicsEvents.HasPostRenderListeners()) + { + Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); + GraphicsEvents.InvokeOnPostRenderEvent(this.Monitor); + Game1.spriteBatch.End(); + } + if ((double)Game1.options.zoomLevel == 1.0) return; this.GraphicsDevice.SetRenderTarget((RenderTarget2D)null); this.GraphicsDevice.Clear(this.bgColor); Game1.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone); Game1.spriteBatch.Draw((Texture2D)this.screenWrapper, Vector2.Zero, new Microsoft.Xna.Framework.Rectangle?(this.screenWrapper.Bounds), Color.White, 0.0f, Vector2.Zero, Game1.options.zoomLevel, SpriteEffects.None, 1f); - GraphicsEvents.InvokeOnPostRenderEvent(this.Monitor); Game1.spriteBatch.End(); } } |