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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
using System;
namespace StardewModdingAPI.Events
{
/// <summary>Events raised during the game's draw loop, when the game is rendering content to the window.</summary>
public static class GraphicsEvents
{
/*********
** Events
*********/
/****
** Generic events
****/
/// <summary>Raised after the game window is resized.</summary>
public static event EventHandler Resize = delegate { };
/// <summary>Raised when drawing debug information to the screen (when <see cref="StardewModdingAPI.Inheritance.SGame.Debug"/> is true). This is called after the sprite batch is begun. If you just want to add debug info, use <see cref="StardewModdingAPI.Inheritance.SGame.DebugMessageQueue" /> in your update loop.</summary>
public static event EventHandler DrawDebug = delegate { };
/// <summary>Obsolete.</summary>
[Obsolete("Use the other Pre/Post render events instead.")]
public static event EventHandler DrawTick = delegate { };
/// <summary>Obsolete.</summary>
[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 { };
/****
** Main render events
****/
/// <summary>Raised before drawing everything to the screen during a draw loop.</summary>
public static event EventHandler OnPreRenderEvent = delegate { };
/// <summary>Raised after drawing everything to the screen during a draw loop.</summary>
public static event EventHandler OnPostRenderEvent = delegate { };
/****
** HUD events
****/
/// <summary>Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The HUD is available at this point, but not necessarily visible. (For example, the event is raised even if a menu is open.)</summary>
public static event EventHandler OnPreRenderHudEvent = delegate { };
/// <summary>Equivalent to <see cref="OnPreRenderHudEvent"/>, but invoked even if the HUD isn't available.</summary>
public static event EventHandler OnPreRenderHudEventNoCheck = delegate { };
/// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the screen. The HUD is available at this point, but not necessarily visible. (For example, the event is raised even if a menu is open.)</summary>
public static event EventHandler OnPostRenderHudEvent = delegate { };
/// <summary>Equivalent to <see cref="OnPostRenderHudEvent"/>, but invoked even if the HUD isn't available.</summary>
public static event EventHandler OnPostRenderHudEventNoCheck = delegate { };
/****
** GUI events
****/
/// <summary>Raised before drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.</summary>
public static event EventHandler OnPreRenderGuiEvent = delegate { };
/// <summary>Equivalent to <see cref="OnPreRenderGuiEvent"/>, but invoked even if there's no menu being drawn.</summary>
public static event EventHandler OnPreRenderGuiEventNoCheck = delegate { };
/// <summary>Raised after drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.</summary>
public static event EventHandler OnPostRenderGuiEvent = delegate { };
/// <summary>Equivalent to <see cref="OnPreRenderGuiEvent"/>, but invoked even if there's no menu being drawn.</summary>
public static event EventHandler OnPostRenderGuiEventNoCheck = delegate { };
/*********
** Internal methods
*********/
/****
** Generic events
****/
/// <summary>Raise a <see cref="Resize"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeResize(object sender, EventArgs e)
{
GraphicsEvents.Resize.Invoke(sender, e);
}
/// <summary>Raise a <see cref="DrawDebug"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeDrawDebug(object sender, EventArgs e)
{
GraphicsEvents.DrawDebug.Invoke(sender, e);
}
/// <summary>Raise a <see cref="DrawTick"/> event.</summary>
[Obsolete("Should not be used.")]
public static void InvokeDrawTick()
{
try
{
GraphicsEvents.DrawTick.Invoke(null, EventArgs.Empty);
}
catch (Exception ex)
{
Log.AsyncR("An exception occured in a Mod's DrawTick: " + ex);
}
}
/// <summary>Raise a <see cref="DrawInRenderTargetTick"/> event.</summary>
[Obsolete("Should not be used.")]
public static void InvokeDrawInRenderTargetTick()
{
GraphicsEvents.DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
}
/****
** Main render events
****/
/// <summary>Raise an <see cref="OnPreRenderEvent"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPreRenderEvent(object sender, EventArgs e)
{
GraphicsEvents.OnPreRenderEvent.Invoke(sender, e);
}
/// <summary>Raise an <see cref="OnPostRenderEvent"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPostRenderEvent(object sender, EventArgs e)
{
GraphicsEvents.OnPostRenderEvent.Invoke(sender, e);
}
/****
** HUD events
****/
/// <summary>Raise an <see cref="OnPreRenderGuiEvent"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPreRenderGuiEvent(object sender, EventArgs e)
{
GraphicsEvents.OnPreRenderGuiEvent.Invoke(sender, e);
}
/// <summary>Raise an <see cref="OnPreRenderGuiEventNoCheck"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPreRenderGuiEventNoCheck(object sender, EventArgs e)
{
GraphicsEvents.OnPreRenderGuiEventNoCheck.Invoke(sender, e);
}
/// <summary>Raise an <see cref="OnPostRenderGuiEvent"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPostRenderGuiEvent(object sender, EventArgs e)
{
GraphicsEvents.OnPostRenderGuiEvent.Invoke(sender, e);
}
/// <summary>Raise an <see cref="OnPostRenderGuiEventNoCheck"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPostRenderGuiEventNoCheck(object sender, EventArgs e)
{
GraphicsEvents.OnPostRenderGuiEventNoCheck.Invoke(sender, e);
}
/****
** GUI events
****/
/// <summary>Raise an <see cref="OnPreRenderHudEvent"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPreRenderHudEvent(object sender, EventArgs e)
{
GraphicsEvents.OnPreRenderHudEvent.Invoke(sender, e);
}
/// <summary>Raise an <see cref="OnPreRenderHudEventNoCheck"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPreRenderHudEventNoCheck(object sender, EventArgs e)
{
GraphicsEvents.OnPreRenderHudEventNoCheck.Invoke(sender, e);
}
/// <summary>Raise an <see cref="OnPostRenderHudEvent"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPostRenderHudEvent(object sender, EventArgs e)
{
GraphicsEvents.OnPostRenderHudEvent.Invoke(sender, e);
}
/// <summary>Raise an <see cref="OnPostRenderHudEventNoCheck"/> event.</summary>
/// <param name="sender">The object which raised the event.</param>
/// <param name="e">The event arguments.</param>
internal static void InvokeOnPostRenderHudEventNoCheck(object sender, EventArgs e)
{
GraphicsEvents.OnPostRenderHudEventNoCheck.Invoke(sender, e);
}
}
}
|