diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-29 19:21:11 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-29 19:21:11 -0500 |
commit | 9ff9d02db5255d5c9ddf9a63cde9e48b28a9eff7 (patch) | |
tree | b9f0ade847f2af574a2d68b8ba827e8fe87d1aa0 /src/StardewModdingAPI.AssemblyRewriters/Wrappers/CompatibleSpriteBatch.cs | |
parent | cc4d3c1cf8755467acc4c72d25bf1e03fd8c4cba (diff) | |
download | SMAPI-9ff9d02db5255d5c9ddf9a63cde9e48b28a9eff7.tar.gz SMAPI-9ff9d02db5255d5c9ddf9a63cde9e48b28a9eff7.tar.bz2 SMAPI-9ff9d02db5255d5c9ddf9a63cde9e48b28a9eff7.zip |
rewrite SpriteBatch.Begin calls for compatibility (#166)
Diffstat (limited to 'src/StardewModdingAPI.AssemblyRewriters/Wrappers/CompatibleSpriteBatch.cs')
-rw-r--r-- | src/StardewModdingAPI.AssemblyRewriters/Wrappers/CompatibleSpriteBatch.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/StardewModdingAPI.AssemblyRewriters/Wrappers/CompatibleSpriteBatch.cs b/src/StardewModdingAPI.AssemblyRewriters/Wrappers/CompatibleSpriteBatch.cs new file mode 100644 index 00000000..e28d1a68 --- /dev/null +++ b/src/StardewModdingAPI.AssemblyRewriters/Wrappers/CompatibleSpriteBatch.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +#pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +namespace StardewModdingAPI.AssemblyRewriters.Wrappers +{ + /// <summary>Wraps <see cref="SpriteBatch"/> methods that are incompatible when converting compiled code between MonoGame and XNA.</summary> + public class CompatibleSpriteBatch : SpriteBatch + { + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + public CompatibleSpriteBatch(GraphicsDevice graphicsDevice) : base(graphicsDevice) { } + + /**** + ** MonoGame signatures + ****/ + public new void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix? matrix) + { + base.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, matrix ?? Matrix.Identity); + } + + /**** + ** XNA signatures + ****/ + public new void Begin() + { + base.Begin(); + } + + public new void Begin(SpriteSortMode sortMode, BlendState blendState) + { + base.Begin(sortMode, blendState); + } + + public new void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState) + { + base.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState); + } + + public new void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect) + { + base.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect); + } + + public new void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix) + { + base.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, transformMatrix); + } + } +}
\ No newline at end of file |