From efcb7fe7051d59c6157aa93da6593b8a1edcf7c7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 4 Nov 2016 19:14:01 -0400 Subject: remove unneeded program fields --- src/StardewModdingAPI/Program.cs | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) (limited to 'src/StardewModdingAPI') diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 70a89112..0b55180b 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -7,7 +7,6 @@ using System.Threading; #if SMAPI_FOR_WINDOWS using System.Windows.Forms; #endif -using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewModdingAPI.Events; using StardewModdingAPI.Framework; @@ -51,15 +50,6 @@ namespace StardewModdingAPI /// The field containing game's main instance. public static FieldInfo StardewGameInfo; - // unused? - public static Thread gameThread; - - /// The thread running the console input thread. - public static Thread consoleInputThread; - - /// A pixel which can be stretched and colourised for display. - public static Texture2D DebugPixel { get; private set; } - // ReSharper disable once PossibleNullReferenceException /// The game's build type (i.e. GOG vs Steam). public static int BuildType => (int)Program.StardewProgramType.GetField("buildType", BindingFlags.Public | BindingFlags.Static).GetValue(null); @@ -194,29 +184,24 @@ namespace StardewModdingAPI // wait for the game to load up while (!Program.ready) Thread.Sleep(1000); - // Create definition to listen for input - Log.AsyncY("Initializing Console Input Thread..."); - Program.consoleInputThread = new Thread(Program.ConsoleInputLoop); - // register help command Command.RegisterCommand("help", "Lists all commands | 'help ' returns command description").CommandFired += Program.help_CommandFired; - // subscribe to events - GameEvents.LoadContent += Program.Events_LoadContent; - // raise game loaded event Log.AsyncY("Game Loaded"); GameEvents.InvokeGameLoaded(); // listen for command line input + Log.AsyncY("Starting console..."); Log.AsyncY("Type 'help' for help, or 'help ' for a command's usage"); - Program.consoleInputThread.Start(); + Thread consoleInputThread = new Thread(Program.ConsoleInputLoop); + consoleInputThread.Start(); while (Program.ready) Thread.Sleep(1000 / 10); // Check if the game is still running 10 times a second - // Abort the thread, we're closing - if (Program.consoleInputThread != null && Program.consoleInputThread.ThreadState == ThreadState.Running) - Program.consoleInputThread.Abort(); + // abort the console thread, we're closing + if (consoleInputThread.ThreadState == ThreadState.Running) + consoleInputThread.Abort(); Log.AsyncY("Game Execution Finished"); Log.AsyncY("Shutting Down..."); @@ -366,16 +351,6 @@ namespace StardewModdingAPI Command.CallCommand(Console.ReadLine()); } - /// Raised before XNA loads or reloads graphics resources. Called during . - /// The event sender. - /// The event data. - private static void Events_LoadContent(object sender, EventArgs e) - { - Log.AsyncY("Initializing Debug Assets..."); - Program.DebugPixel = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1); - Program.DebugPixel.SetData(new[] { Color.White }); - } - /// The method called when the user submits the help command in the console. /// The event sender. /// The event data. -- cgit