summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events/GameEvents.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 14:48:23 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 14:48:23 -0400
commit7fe85119219c17d459fd5a373916dafff7b4e2a2 (patch)
tree85e17035489dbeeb1ea5d44d18b7e868cfb93754 /src/StardewModdingAPI/Events/GameEvents.cs
parentd9adaf73869ce768686301ef30687a5fc18048a0 (diff)
downloadSMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.tar.gz
SMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.tar.bz2
SMAPI-7fe85119219c17d459fd5a373916dafff7b4e2a2.zip
document & format event code
Diffstat (limited to 'src/StardewModdingAPI/Events/GameEvents.cs')
-rw-r--r--src/StardewModdingAPI/Events/GameEvents.cs80
1 files changed, 46 insertions, 34 deletions
diff --git a/src/StardewModdingAPI/Events/GameEvents.cs b/src/StardewModdingAPI/Events/GameEvents.cs
index 1a366011..e4a0e08d 100644
--- a/src/StardewModdingAPI/Events/GameEvents.cs
+++ b/src/StardewModdingAPI/Events/GameEvents.cs
@@ -2,58 +2,61 @@
namespace StardewModdingAPI.Events
{
+ /// <summary>Events raised when the game changes state.</summary>
public static class GameEvents
{
- public static event EventHandler GameLoaded = delegate { };
+ /*********
+ ** Events
+ *********/
+ /// <summary>Raised during launch after configuring XNA or MonoGame. The game window hasn't been opened by this point. Called during <see cref="Microsoft.Xna.Framework.Game.Initialize"/>.</summary>
public static event EventHandler Initialize = delegate { };
+
+ /// <summary>Raised during launch after configuring Stardew Valley, loading it into memory, and opening the game window. The window is still blank by this point.</summary>
+ public static event EventHandler GameLoaded = delegate { };
+
+ /// <summary>Raised before XNA loads or reloads graphics resources. Called during <see cref="Microsoft.Xna.Framework.Game.LoadContent"/>.</summary>
public static event EventHandler LoadContent = delegate { };
+
+ /// <summary>Raised during the first game update tick.</summary>
public static event EventHandler FirstUpdateTick = delegate { };
- /// <summary>
- /// Fires every update (1/60 of a second)
- /// </summary>
+ /// <summary>Raised when the game updates its state (≈60 times per second).</summary>
public static event EventHandler UpdateTick = delegate { };
- /// <summary>
- /// Fires every other update (1/30 of a second)
- /// </summary>
+ /// <summary>Raised every other tick (≈30 times per second).</summary>
public static event EventHandler SecondUpdateTick = delegate { };
- /// <summary>
- /// Fires every fourth update (1/15 of a second)
- /// </summary>
+ /// <summary>Raised every fourth tick (≈15 times per second).</summary>
public static event EventHandler FourthUpdateTick = delegate { };
- /// <summary>
- /// Fires every eighth update (roughly 1/8 of a second)
- /// </summary>
+ /// <summary>Raised every eighth tick (≈8 times per second).</summary>
public static event EventHandler EighthUpdateTick = delegate { };
- /// <summary>
- /// Fires every fifthteenth update (1/4 of a second)
- /// </summary>
+ /// <summary>Raised every 15th tick (≈4 times per second).</summary>
public static event EventHandler QuarterSecondTick = delegate { };
- /// <summary>
- /// Fires every thirtieth update (1/2 of a second)
- /// </summary>
+ /// <summary>Raised every 30th tick (≈twice per second).</summary>
public static event EventHandler HalfSecondTick = delegate { };
- /// <summary>
- /// Fires every sixtieth update (a second)
- /// </summary>
+ /// <summary>Raised every 60th tick (≈once per second).</summary>
public static event EventHandler OneSecondTick = delegate { };
+
+ /*********
+ ** Internal methods
+ *********/
+ /// <summary>Raise a <see cref="GameLoaded"/> event.</summary>
internal static void InvokeGameLoaded()
{
- GameLoaded.Invoke(null, EventArgs.Empty);
+ GameEvents.GameLoaded.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise an <see cref="Initialize"/> event.</summary>
internal static void InvokeInitialize()
{
try
{
- Initialize.Invoke(null, EventArgs.Empty);
+ GameEvents.Initialize.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
@@ -61,11 +64,12 @@ namespace StardewModdingAPI.Events
}
}
+ /// <summary>Raise a <see cref="LoadContent"/> event.</summary>
internal static void InvokeLoadContent()
{
try
{
- LoadContent.Invoke(null, EventArgs.Empty);
+ GameEvents.LoadContent.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
@@ -73,11 +77,12 @@ namespace StardewModdingAPI.Events
}
}
+ /// <summary>Raise an <see cref="UpdateTick"/> event.</summary>
internal static void InvokeUpdateTick()
{
try
{
- UpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.UpdateTick.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
@@ -85,39 +90,46 @@ namespace StardewModdingAPI.Events
}
}
+ /// <summary>Raise a <see cref="SecondUpdateTick"/> event.</summary>
internal static void InvokeSecondUpdateTick()
{
- SecondUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.SecondUpdateTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="FourthUpdateTick"/> event.</summary>
internal static void InvokeFourthUpdateTick()
{
- FourthUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.FourthUpdateTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="EighthUpdateTick"/> event.</summary>
internal static void InvokeEighthUpdateTick()
{
- EighthUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.EighthUpdateTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="QuarterSecondTick"/> event.</summary>
internal static void InvokeQuarterSecondTick()
{
- QuarterSecondTick.Invoke(null, EventArgs.Empty);
+ GameEvents.QuarterSecondTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="HalfSecondTick"/> event.</summary>
internal static void InvokeHalfSecondTick()
{
- HalfSecondTick.Invoke(null, EventArgs.Empty);
+ GameEvents.HalfSecondTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="OneSecondTick"/> event.</summary>
internal static void InvokeOneSecondTick()
{
- OneSecondTick.Invoke(null, EventArgs.Empty);
+ GameEvents.OneSecondTick.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Raise a <see cref="FirstUpdateTick"/> event.</summary>
internal static void InvokeFirstUpdateTick()
{
- FirstUpdateTick.Invoke(null, EventArgs.Empty);
+ GameEvents.FirstUpdateTick.Invoke(null, EventArgs.Empty);
}
}
-} \ No newline at end of file
+}