コード例 #1
0
        public static void Main()
        {
            //Opens a new Graphics Window("Battleships", 800, 600);
            SwinGame.OpenGraphicsWindow("Battleships", 800, 600);

            //Load Resources
            GameResources.LoadResources();

            SwinGame.PlayMusic(GameResources.GameMusic("Background"));

            //Game Loop
            do
            {
                GameController.HandleUserInput();
                GameController.DrawScreen();
                if (SwinGame.KeyTyped(KeyCode.vk_F10))
                {
                    SwinGame.ToggleFullScreen();
                }
            } while (!(SwinGame.WindowCloseRequested() == true | GameController.CurrentState == GameState.Quitting));

            SwinGame.StopMusic();

            //Free Resources and Close Audio, to end the program.
            GameResources.FreeResources();
        }
コード例 #2
0
        public static int Main()
        {
            //Opens a new Graphics Window
            SwinGame.OpenGraphicsWindow("Battle Ships", 800, 600);

            //Load Resources
            GameResources.LoadResources();

            SwinGame.PlayMusic(GameResources.GameMusic("Background"));

            //Game Loop
            do
            {
                GameController.HandleUserInput();
                GameController.DrawScreen();
            } while (!(SwinGame.WindowCloseRequested() == true | GameController.CurrentState == GameState.Quitting));

            SwinGame.StopMusic();

            //Free Resources and Close Audio, to end the program.
            try
            {
                GameResources.FreeResources();
            }
            catch (Exception e)
            {
                System.Console.WriteLine("The following exception is due to .NET 4+");
                System.Console.WriteLine(e.Message);
                return(1);
            }

            return(0);
        }