#if !SMAPI_3_0_STRICT
using System;
using StardewModdingAPI.Framework;
using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
/// Events raised during the game's draw loop, when the game is rendering content to the window.
[Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")]
public static class GraphicsEvents
{
/*********
** Properties
*********/
/// The core event manager.
private static EventManager EventManager;
/// Manages deprecation warnings.
private static DeprecationManager DeprecationManager;
/*********
** Events
*********/
/// Raised after the game window is resized.
public static event EventHandler Resize
{
add
{
GraphicsEvents.DeprecationManager.WarnForOldEvents();
GraphicsEvents.EventManager.Legacy_Resize.Add(value);
}
remove => GraphicsEvents.EventManager.Legacy_Resize.Remove(value);
}
/****
** Main render events
****/
/// Raised before drawing the world to the screen.
public static event EventHandler OnPreRenderEvent
{
add
{
GraphicsEvents.DeprecationManager.WarnForOldEvents();
GraphicsEvents.EventManager.Legacy_OnPreRenderEvent.Add(value);
}
remove => GraphicsEvents.EventManager.Legacy_OnPreRenderEvent.Remove(value);
}
/// Raised after drawing the world to the screen.
public static event EventHandler OnPostRenderEvent
{
add
{
GraphicsEvents.DeprecationManager.WarnForOldEvents();
GraphicsEvents.EventManager.Legacy_OnPostRenderEvent.Add(value);
}
remove => GraphicsEvents.EventManager.Legacy_OnPostRenderEvent.Remove(value);
}
/****
** HUD events
****/
/// 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.)
public static event EventHandler OnPreRenderHudEvent
{
add
{
GraphicsEvents.DeprecationManager.WarnForOldEvents();
GraphicsEvents.EventManager.Legacy_OnPreRenderHudEvent.Add(value);
}
remove => GraphicsEvents.EventManager.Legacy_OnPreRenderHudEvent.Remove(value);
}
/// 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.)
public static event EventHandler OnPostRenderHudEvent
{
add
{
GraphicsEvents.DeprecationManager.WarnForOldEvents();
GraphicsEvents.EventManager.Legacy_OnPostRenderHudEvent.Add(value);
}
remove => GraphicsEvents.EventManager.Legacy_OnPostRenderHudEvent.Remove(value);
}
/****
** GUI events
****/
/// Raised before drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.
public static event EventHandler OnPreRenderGuiEvent
{
add
{
GraphicsEvents.DeprecationManager.WarnForOldEvents();
GraphicsEvents.EventManager.Legacy_OnPreRenderGuiEvent.Add(value);
}
remove => GraphicsEvents.EventManager.Legacy_OnPreRenderGuiEvent.Remove(value);
}
/// Raised after drawing a menu to the screen during a draw loop. This includes the game's internal menus like the title screen.
public static event EventHandler OnPostRenderGuiEvent
{
add
{
GraphicsEvents.DeprecationManager.WarnForOldEvents();
GraphicsEvents.EventManager.Legacy_OnPostRenderGuiEvent.Add(value);
}
remove => GraphicsEvents.EventManager.Legacy_OnPostRenderGuiEvent.Remove(value);
}
/*********
** Public methods
*********/
/// Initialise the events.
/// The core event manager.
/// Manages deprecation warnings.
internal static void Init(EventManager eventManager, DeprecationManager deprecationManager)
{
GraphicsEvents.EventManager = eventManager;
GraphicsEvents.DeprecationManager = deprecationManager;
}
}
}
#endif