#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 { /********* ** Fields *********/ /// The core event manager. private static EventManager EventManager; /********* ** Events *********/ /// Raised after the game window is resized. public static event EventHandler Resize { add { SCore.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 { SCore.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 { SCore.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 { SCore.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 { SCore.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 { SCore.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 { SCore.DeprecationManager.WarnForOldEvents(); GraphicsEvents.EventManager.Legacy_OnPostRenderGuiEvent.Add(value); } remove => GraphicsEvents.EventManager.Legacy_OnPostRenderGuiEvent.Remove(value); } /********* ** Public methods *********/ /// Initialise the events. /// The core event manager. internal static void Init(EventManager eventManager) { GraphicsEvents.EventManager = eventManager; } } } #endif