Пример #1
0
        // The program's entry point.
        public static void Main(string[] args)
        {
            // Set the static game variables.
            Surrounded.Options = Options.Load(args.Length > 0 ? args[0] : "options");
            Surrounded.Icon    = new Image(Path.Combine(Environment.CurrentDirectory, "icon.png"));
            Surrounded.RNG     = new Random();

            // Check the Steam API.
            Surrounded.SteamOnline = SteamAPI.Init();
            if (Surrounded.SteamOnline)
            {
                Console.WriteLine("Steam is connected!");
                Console.Write("Username: "******"Steam is not connected.");
            }

            // Load up the other game stuff.
            Surrounded.Player = new Player();
            Surrounded.Map    = new Map(Surrounded.Player, "default");

            // Start the game.
            Surrounded.Instance = new Surrounded();
        }
Пример #2
0
        // Fired when a key is released.
        private void OnKeyReleased(object sender, KeyEventArgs e)
        {
            if (e.Code == Keyboard.Key.Insert)
            {
                // Close the current window.
                Surrounded.Options.Save();
                this.Close();

                // Update the settings.
                Surrounded.Options.Fullscreen = !Surrounded.Options.Fullscreen;
                Surrounded.Instance           = new Surrounded();
            }
            else if (e.Code == Keyboard.Key.Escape)
            {
                // Close the current window.
                Surrounded.Options.Save();
                this.Close();
            }
            else if (e.Code == Keyboard.Key.BackSpace)
            {
                this.DrawDarkness = !this.DrawDarkness;
            }
        }