From bcaf5b21c1e64ddca29b27d2b96652a3d925d8ff Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 23 Apr 2017 18:57:43 -0400 Subject: remove Initialize/LoadContent overrides & deprecate related events (#265) --- src/StardewModdingAPI/Framework/SGame.cs | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/StardewModdingAPI/Framework') diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs index 0b4d7494..0bbab904 100644 --- a/src/StardewModdingAPI/Framework/SGame.cs +++ b/src/StardewModdingAPI/Framework/SGame.cs @@ -48,7 +48,7 @@ namespace StardewModdingAPI.Framework ** Game state ****/ /// Arrays of pressed controller buttons indexed by . - private Buttons[][] PreviouslyPressedButtons; + private readonly Buttons[][] PreviouslyPressedButtons = { new Buttons[0], new Buttons[0], new Buttons[0], new Buttons[0] }; /// A record of the keyboard state (i.e. the up/down state for each button) as of the latest tick. private KeyboardState KStateNow; @@ -173,31 +173,17 @@ namespace StardewModdingAPI.Framework /**** ** Intercepted methods & events ****/ - /// The method called during game launch after configuring XNA or MonoGame. The game window hasn't been opened by this point. - protected override void Initialize() - { - this.PreviouslyPressedButtons = new Buttons[4][]; - for (var i = 0; i < 4; ++i) - this.PreviouslyPressedButtons[i] = new Buttons[0]; - - base.Initialize(); - GameEvents.InvokeInitialize(this.Monitor); - } - - /// The method called before XNA or MonoGame loads or reloads graphics resources. - protected override void LoadContent() - { - base.LoadContent(); - GameEvents.InvokeLoadContent(this.Monitor); - } - /// The method called when the game is updating its state. This happens roughly 60 times per second. /// A snapshot of the game timing state. protected override void Update(GameTime gameTime) { // raise game loaded if (this.FirstUpdate) + { + GameEvents.InvokeInitialize(this.Monitor); + GameEvents.InvokeLoadContent(this.Monitor); GameEvents.InvokeGameLoaded(this.Monitor); + } // update SMAPI events this.UpdateEventCalls(); -- cgit