summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SGame.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/SGame.cs')
-rw-r--r--src/SMAPI/Framework/SGame.cs21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index b2d92ce8..d09e1e93 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -19,6 +19,7 @@ using StardewModdingAPI.Framework.Input;
using StardewModdingAPI.Framework.Networking;
using StardewModdingAPI.Framework.PerformanceMonitoring;
using StardewModdingAPI.Framework.Reflection;
+using StardewModdingAPI.Framework.Rendering;
using StardewModdingAPI.Framework.StateTracking.Comparers;
using StardewModdingAPI.Framework.StateTracking.Snapshots;
using StardewModdingAPI.Framework.Utilities;
@@ -193,6 +194,13 @@ namespace StardewModdingAPI.Framework
Game1.locations = new ObservableCollection<GameLocation>();
}
+ /// <summary>Load content when the game is launched.</summary>
+ protected override void LoadContent()
+ {
+ base.LoadContent();
+ Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, this.GraphicsDevice);
+ }
+
/// <summary>Initialize just before the game's first update tick.</summary>
private void InitializeAfterGameStarted()
{
@@ -252,12 +260,12 @@ namespace StardewModdingAPI.Framework
// update data
LoadStage oldStage = Context.LoadStage;
Context.LoadStage = newStage;
+ this.Monitor.VerboseLog($"Context: load stage changed to {newStage}");
if (newStage == LoadStage.None)
{
this.Monitor.Log("Context: returned to title", LogLevel.Trace);
- this.Multiplayer.CleanupOnMultiplayerExit();
+ this.OnReturnedToTitle();
}
- this.Monitor.VerboseLog($"Context: load stage changed to {newStage}");
// raise events
this.Events.LoadStageChanged.Raise(new LoadStageChangedEventArgs(oldStage, newStage));
@@ -283,6 +291,15 @@ namespace StardewModdingAPI.Framework
}
}
+ /// <summary>Perform cleanup when the game returns to the title screen.</summary>
+ private void OnReturnedToTitle()
+ {
+ this.Multiplayer.CleanupOnMultiplayerExit();
+
+ if (!(Game1.mapDisplayDevice is SDisplayDevice))
+ Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, this.GraphicsDevice);
+ }
+
/// <summary>Constructor a content manager to read XNB files.</summary>
/// <param name="serviceProvider">The service provider to use to locate services.</param>
/// <param name="rootDirectory">The root directory to search for content.</param>