summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/SGame.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-05-09 00:11:39 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-05-09 00:11:39 -0400
commit486ac29796586e09540723dcae8070cf3e60285b (patch)
tree50b9c473ef8e89f17f631af4b183dcb6379acf74 /src/StardewModdingAPI/Framework/SGame.cs
parent85f609dc6c2f02d89b9fccaacfe837f8822d6b7c (diff)
downloadSMAPI-486ac29796586e09540723dcae8070cf3e60285b.tar.gz
SMAPI-486ac29796586e09540723dcae8070cf3e60285b.tar.bz2
SMAPI-486ac29796586e09540723dcae8070cf3e60285b.zip
use shared reflection helper
Diffstat (limited to 'src/StardewModdingAPI/Framework/SGame.cs')
-rw-r--r--src/StardewModdingAPI/Framework/SGame.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs
index d248c3ca..8786010e 100644
--- a/src/StardewModdingAPI/Framework/SGame.cs
+++ b/src/StardewModdingAPI/Framework/SGame.cs
@@ -9,7 +9,6 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using StardewModdingAPI.Events;
-using StardewModdingAPI.Framework.Reflection;
using StardewValley;
using StardewValley.BellsAndWhistles;
using StardewValley.Locations;
@@ -157,9 +156,11 @@ namespace StardewModdingAPI.Framework
/****
** Private wrappers
****/
+ /// <summary>Simplifies access to private game code.</summary>
+ private static IReflectionHelper Reflection;
+
// ReSharper disable ArrangeStaticMemberQualifier, ArrangeThisQualifier, InconsistentNaming
/// <summary>Used to access private fields and methods.</summary>
- private static readonly IReflectionHelper Reflection = new ReflectionHelper();
private static List<float> _fpsList => SGame.Reflection.GetPrivateField<List<float>>(typeof(Game1), nameof(_fpsList)).GetValue();
private static Stopwatch _fpsStopwatch => SGame.Reflection.GetPrivateField<Stopwatch>(typeof(Game1), nameof(SGame._fpsStopwatch)).GetValue();
private static float _fps
@@ -176,6 +177,7 @@ namespace StardewModdingAPI.Framework
private readonly Action renderScreenBuffer = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(renderScreenBuffer)).Invoke(new object[0]);
// ReSharper restore ArrangeStaticMemberQualifier, ArrangeThisQualifier, InconsistentNaming
+
/*********
** Accessors
*********/
@@ -188,11 +190,13 @@ namespace StardewModdingAPI.Framework
*********/
/// <summary>Construct an instance.</summary>
/// <param name="monitor">Encapsulates monitoring and logging.</param>
- internal SGame(IMonitor monitor)
+ /// <param name="reflection">Simplifies access to private game code.</param>
+ internal SGame(IMonitor monitor, IReflectionHelper reflection)
{
this.Monitor = monitor;
this.FirstUpdate = true;
SGame.Instance = this;
+ SGame.Reflection = reflection;
Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef; // required by Stardew Valley
}