1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
using System;
namespace StardewModdingAPI.Events
{
/// <summary>
///
/// </summary>
public static class GraphicsEvents
{
/// <summary>
/// Occurs when the form (game) is resized.
/// </summary>
public static event EventHandler Resize = delegate { };
/// <summary>
/// Occurs before anything is drawn.
/// </summary>
public static event EventHandler OnPreRenderEvent = delegate { };
/// <summary>
/// Occurs before the GUI is drawn.
/// </summary>
public static event EventHandler OnPreRenderGuiEvent = delegate { };
/// <summary>
/// Occurs after the GUI is drawn.
/// </summary>
public static event EventHandler OnPostRenderGuiEvent = delegate { };
/// <summary>
/// Occurs before the HUD is drawn.
/// </summary>
public static event EventHandler OnPreRenderHudEvent = delegate { };
/// <summary>
/// Occurs after the HUD is drawn.
/// </summary>
public static event EventHandler OnPostRenderHudEvent = delegate { };
/// <summary>
/// Occurs after everything is drawn.
/// </summary>
public static event EventHandler OnPostRenderEvent = delegate { };
/// <summary>
/// Draws when SGame.Debug is true. F3 toggles this.
/// Game1.spriteBatch.Begin() is pre-called.
/// Do not make end or begin calls to the spritebatch.
/// If you are only trying to add debug information, use SGame.DebugMessageQueue in your Update loop.
/// </summary>
public static event EventHandler DrawDebug = delegate { };
internal static void InvokeDrawDebug(object sender, EventArgs e)
{
DrawDebug.Invoke(sender, e);
}
internal static void InvokeOnPreRenderEvent(object sender, EventArgs e)
{
OnPreRenderEvent.Invoke(sender, e);
}
internal static void InvokeOnPreRenderGuiEvent(object sender, EventArgs e)
{
OnPreRenderGuiEvent.Invoke(sender, e);
}
internal static void InvokeOnPostRenderGuiEvent(object sender, EventArgs e)
{
OnPostRenderGuiEvent.Invoke(sender, e);
}
internal static void InvokeOnPreRenderHudEvent(object sender, EventArgs e)
{
OnPreRenderHudEvent.Invoke(sender, e);
}
internal static void InvokeOnPostRenderHudEvent(object sender, EventArgs e)
{
OnPostRenderHudEvent.Invoke(sender, e);
}
internal static void InvokeOnPostRenderEvent(object sender, EventArgs e)
{
OnPostRenderEvent.Invoke(sender, e);
}
#region To Remove
[Obsolete("Use the other Pre/Post render events instead.")]
public static event EventHandler DrawTick = delegate { };
[Obsolete("Use the other Pre/Post render events instead. All of them will automatically be drawn into the render target if needed.")]
public static event EventHandler DrawInRenderTargetTick = delegate { };
[Obsolete("Should not be used.")]
public static void InvokeDrawTick()
{
try
{
DrawTick.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
Log.AsyncR("An exception occured in a Mod's DrawTick: " + ex);
}
}
[Obsolete("Should not be used.")]
public static void InvokeDrawInRenderTargetTick()
{
DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
}
[Obsolete("Should not be used.")]
public static void InvokeResize(object sender, EventArgs e)
{
Resize.Invoke(sender, e);
}
#endregion
}
}
|