Example #1
0
        public void Init()
        {
            // Not exiting
            Exiting = false;

            // Startup message
            Log("*****************");
            Log("* FTL Overdrive *");
            Log("*****************");

            // Load settings
            Log("Loading settings...");
            Settings = new SettingsFile("settings.ini");
            Settings.SetPopulate(true);

            // Lookup directory
            if (Settings.ReadString("File", "FTLDirectory", "unknown") == "unknown")
            {
                string dir = Util.LocateFTLPath();
                if (dir == null)
                {
                    Log("Unable to locate the FTL files!");
                    Settings.Save();
                    return;
                }
                Settings.WriteString("File", "FTLDirectory", dir);
            }
            Settings.Save();

            // Init file system
            Log("Mounting resources.dat...");
            archive = new Archive(Settings.ReadString("File", "FTLDirectory") + "resources/resource.dat");

            // Init window
            Log("Loading window...");
            LoadWindow();

            // Init resources
            dctMaterials = new Dictionary <string, Texture>();
            dctMusic     = new Dictionary <string, Music>();
            dctSound     = new Dictionary <string, SoundBuffer>();
            dctFonts     = new Dictionary <string, SFML.Graphics.Font>();

            // Init state manager
            mgrState = new Gamestate.StateController();

            // Init mods
            Log("Loading modding API...");
            mgrState.Activate <Gamestate.Library>();
            mgrState.Activate <Gamestate.ModdingAPI>();
            Log("Loading mods...");
            mgrState.Get <Gamestate.ModdingAPI>().LoadMods();

            // Load library
            mgrState.Get <Gamestate.ModdingAPI>().CallHook("Game.LoadLibrary");

            // Main menu state
            Log("Starting game...");
            mgrState.FSMTransist <Gamestate.MainMenu>();

            // Save settings
            Settings.Save();
            Settings.SetPopulate(false);

            // Start timer
            timer = new Stopwatch();
            timer.Start();
        }
Example #2
0
        public void Init()
        {
            // Not exiting
            Exiting = false;

            // Startup message
            Log("*****************");
            Log("* FTL Overdrive *");
            Log("*****************");

            // Load settings
            Log("Loading settings...");
            Settings = new SettingsFile("settings.ini");
            Settings.SetPopulate(true);

            // Lookup directory
            if (Settings.ReadString("File", "FTLDirectory", "unknown") == "unknown")
            {
                string dir = Util.LocateFTLPath();
                if (dir == null)
                {
                    Log("Unable to locate the FTL files!");
                    Log("Enter file path manually:");
                    dir = Console.ReadLine();

                    if (!Directory.Exists(dir))
                    {
                        Settings.Save();
                        return;
                    }
                }
                Settings.WriteString("File", "FTLDirectory", dir);
            }
            Settings.Save();

            // Init file system
            Log("Mounting resources.dat...");
            archive = new Archive(Settings.ReadString("File", "FTLDirectory") + "resources/resource.dat");

            // Init window
            Log("Loading window...");
            LoadWindow();

            // Init resources
            dctMaterials = new Dictionary<string, Texture>();
            dctMusic = new Dictionary<string, Music>();
            dctSound = new Dictionary<string, SoundBuffer>();
            dctFonts = new Dictionary<string, SFML.Graphics.Font>();

            // Init state manager
            mgrState = new Gamestate.StateController();

            // Init mods
            Log("Loading modding API...");
            mgrState.Activate<Gamestate.Library>();
            mgrState.Activate<Gamestate.ModdingAPI>();
            Log("Loading mods...");
            mgrState.Get<Gamestate.ModdingAPI>().LoadMods();

            // Load library
            mgrState.Get<Gamestate.ModdingAPI>().CallHook("Game.LoadLibrary");

            // Main menu state
            Log("Starting game...");
            mgrState.FSMTransist<MainMenu>();

            // Save settings
            Settings.Save();
            Settings.SetPopulate(false);

            // Start timer
            timer = new Stopwatch();
            timer.Start();
        }