summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SGame.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-27 17:06:15 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-27 17:06:15 -0400
commitab8599583e549bda59bc3e0783bd5e1657ef7b1b (patch)
tree6096cc071f3693cdc2c5268ec347005c223b1075 /src/SMAPI/Framework/SGame.cs
parent31e31538f128f2a79b553a2cc20fe8a6f13e8a06 (diff)
downloadSMAPI-ab8599583e549bda59bc3e0783bd5e1657ef7b1b.tar.gz
SMAPI-ab8599583e549bda59bc3e0783bd5e1657ef7b1b.tar.bz2
SMAPI-ab8599583e549bda59bc3e0783bd5e1657ef7b1b.zip
fix SMAPI's display device not hooked correctly in split-screen mode
Diffstat (limited to 'src/SMAPI/Framework/SGame.cs')
-rw-r--r--src/SMAPI/Framework/SGame.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index 55ab8377..4e134455 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -54,6 +54,9 @@ namespace StardewModdingAPI.Framework
/// <summary>Raised when the instance is updating its state (roughly 60 times per second).</summary>
private readonly Action<SGame, GameTime, Action> OnUpdating;
+ /// <summary>Raised after the instance finishes loading its initial content.</summary>
+ private readonly Action OnContentLoaded;
+
/*********
** Accessors
@@ -106,7 +109,8 @@ namespace StardewModdingAPI.Framework
/// <param name="multiplayer">The core multiplayer logic.</param>
/// <param name="exitGameImmediately">Immediately exit the game without saving. This should only be invoked when an irrecoverable fatal error happens that risks save corruption or game-breaking bugs.</param>
/// <param name="onUpdating">Raised when the instance is updating its state (roughly 60 times per second).</param>
- public SGame(PlayerIndex playerIndex, int instanceIndex, Monitor monitor, Reflector reflection, EventManager eventManager, SInputState input, SModHooks modHooks, SMultiplayer multiplayer, Action<string> exitGameImmediately, Action<SGame, GameTime, Action> onUpdating)
+ /// <param name="onContentLoaded">Raised after the game finishes loading its initial content.</param>
+ public SGame(PlayerIndex playerIndex, int instanceIndex, Monitor monitor, Reflector reflection, EventManager eventManager, SInputState input, SModHooks modHooks, SMultiplayer multiplayer, Action<string> exitGameImmediately, Action<SGame, GameTime, Action> onUpdating, Action onContentLoaded)
: base(playerIndex, instanceIndex)
{
// init XNA
@@ -124,6 +128,7 @@ namespace StardewModdingAPI.Framework
this.Reflection = reflection;
this.ExitGameImmediately = exitGameImmediately;
this.OnUpdating = onUpdating;
+ this.OnContentLoaded = onContentLoaded;
}
/// <summary>Get the current input state for a button.</summary>
@@ -138,6 +143,13 @@ namespace StardewModdingAPI.Framework
return input.GetState(button);
}
+ /// <inheritdoc />
+ protected override void LoadContent()
+ {
+ base.LoadContent();
+
+ this.OnContentLoaded();
+ }
/*********
** Protected methods