diff options
-rw-r--r-- | release-notes.md | 1 | ||||
-rw-r--r-- | src/StardewModdingAPI/Context.cs | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/release-notes.md b/release-notes.md index b9aabbf5..3bf68a1e 100644 --- a/release-notes.md +++ b/release-notes.md @@ -20,6 +20,7 @@ For players: * Fixed "unknown mod" deprecation warnings by improving how SMAPI detects the mod using the event. For modders: +* Added `Context.IsInDrawLoop` for specialised mods. * You can now list mod dependencies in the `manifest.json`. SMAPI will make sure your dependencies are loaded before your mod, and will show a friendly error if a dependency is missing. * Fixed `smapi-crash.txt` being copied from the default log even if a different path is specified with `--log-path`. diff --git a/src/StardewModdingAPI/Context.cs b/src/StardewModdingAPI/Context.cs index 6bc5ae56..6ceabd5a 100644 --- a/src/StardewModdingAPI/Context.cs +++ b/src/StardewModdingAPI/Context.cs @@ -1,4 +1,5 @@ -using StardewValley; +using StardewModdingAPI.Events; +using StardewValley; using StardewValley.Menus; namespace StardewModdingAPI @@ -15,6 +16,9 @@ namespace StardewModdingAPI /// <summary>Whether the player has loaded a save and the world has finished initialising.</summary> public static bool IsWorldReady { get; internal set; } + /// <summary>Whether the game is currently running the draw loop. This isn't relevant to most mods, since you should use <see cref="GraphicsEvents.OnPostRenderEvent"/> to draw to the screen.</summary> + public static bool IsInDrawLoop { get; set; } + /**** ** Internal ****/ @@ -23,8 +27,5 @@ namespace StardewModdingAPI /// <summary>Whether the game is currently writing to the save file.</summary> internal static bool IsSaving => Game1.activeClickableMenu is SaveGameMenu || Game1.activeClickableMenu is ShippingMenu; // saving is performed by SaveGameMenu, but it's wrapped by ShippingMenu on days when the player shipping something - - /// <summary>Whether the game is currently running the draw loop.</summary> - internal static bool IsInDrawLoop { get; set; } } } |