Esempio n. 1
0
        public static void Main()
        {
            //Open the game window
            OpenGraphicsWindow("GameMain", 800, 600);
            ShowSwinGameSplashScreen();

            // Load Resources
            GameResources.LoadResources();

            //Play the game's background music
            SwinGame.PlayMusic("Background");
            //Run the game loop
            while (false == WindowCloseRequested())
            {
                //Clear the screen and draw the framerate
                ClearScreen(Color.White);
                DrawFramerate(0, 0);


                GameController.HandleUserInput();
                GameController.DrawScreen();

                //Fetch the next batch of UI interaction
                ProcessEvents();

                //Draw onto the screen
                RefreshScreen(60);
            }

            //Stop the background music when the window is closed
            SwinGame.StopMusic();

            // Free Resources and Close Audio, to end the program.
            GameResources.FreeResources();
        }
Esempio n. 2
0
        public static void Main()
        {
            // Opens a new Graphics Window
            OpenGraphicsWindow("Battle Ships", 800, 600);

            // Load Resources
            GameResources.LoadResources();

            PlayMusic(GameResources.GameMusic("Background"));
            SetMusicVolume(UtilityFunctions.VolumeLevel);

            // Game Loop
            do
            {
                GameController.HandleUserInput();
                GameController.DrawScreen();
            }
            //Only run the loop until a window close request is processed, or the game state becomes 'quitting'
            while (!WindowCloseRequested() && GameController.CurrentState != GameState.Quitting);

            StopMusic();

            // Free Resources and Close Audio, to end the program.
            GameResources.FreeResources();
        }
Esempio n. 3
0
        public static void Main()
        {
            //Open the game window
            OpenGraphicsWindow("GameMain", 800, 600);
            //ShowSwinGameSplashScreen();


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

            //Run the game loop
            while (false == WindowCloseRequested())
            {
                GameController.HandleUserInput();
                GameController.DrawScreen();
            }
        }
Esempio n. 4
0
        public static void Main()
        {
            SwinGame.OpenGraphicsWindow("BattleShips", 800, 600);
            // ShowSwinGameSplashScreen(); //This wasn't in the vB
            //Load Resources

            GameResources  res = new GameResources();
            GameController con = new GameController(res);

            con._resources.LoadResources();
            //LoadResources();

            SwinGame.PlayMusic(con._resources.GameMusic("Background"));

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

            ////Run the game loop
            while (false == SwinGame.WindowCloseRequested() && con.CurrentState != GameState.Quitting)
            {
                //Fetch the next batch of UI interaction
                con.HandleUserInput();

                //Clear the screen and draw the framerate
                ClearScreen(Color.White);
                DrawFramerate(0, 0);

                //Draw onto the screen
                con.DrawScreen();
            }

            StopMusic();

            //Free Resources and Close Audio, to end the program.
            con._resources.FreeResources();
        }
Esempio n. 5
0
        public static void 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.
            GameResources.FreeResources();
        }
Esempio n. 6
0
        public static void Main()
        {
            //Open the game window
            SwinGame.OpenGraphicsWindow("Battle Ships", 800, 600);
            //SwinGame.ShowSwinGameSplashScreen();

            //Load Resources
            GameResources.LoadResources();

            GameController.PlayMusic();

            //Run the game loop
            while (!(true == SwinGame.WindowCloseRequested() || GameController.CurrentState == GameState.Quitting))
            {
                GameController.HandleUserInput();
                GameController.DrawScreen();
            }

            SwinGame.StopMusic();

            GameResources.FreeResources();
        }
Esempio n. 7
0
        public static void Main()
        {
            //Open the game window
            SwinGame.OpenGraphicsWindow("Bejeweled", 750, 630);             //549, 700
            UIController.LoadResources();

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

            //generate blocks for the board
            GameController.Board.GenerateBlock();

            //check for matching, delete matching blocks and generate new blocks until there is no matching blocks in it
            while (GameController.Board.CheckMatching())
            {
                GameController.Board.CheckMatching();
                GameController.Board.GenerateBlock();
            }

            //initialize the score to 0
            GameController.Board.Score = 0;

            //Run the game loop
            while (false == SwinGame.WindowCloseRequested() && GameController.GameState != GameState.Quitting)
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();

                //Clear the screen and draw the framerate
                SwinGame.ClearScreen(Color.Black);

                if (GameController.GameState == GameState.ViewingGameMenu)
                {
                    UIController.DrawMenuPage();
                    GameController.HandleUserInput();
                }

                //show the instruction page
                if (GameController.GameState == GameState.ViewingGameInstruction)
                {
                    UIController.DrawInstructionPage();
                    GameController.HandleUserInput();
                }

                //if player chose to start the game, display the board and start the game
                if (GameController.GameState == GameState.PlayingGame)
                {
                    //Draw game board
                    GameController.Board.DrawBoard();

                    SwinGame.StopMusic();

                    //when time reaches 1 minute, show the final score page
                    if (UIController.TimeTicks >= UIController.EndTime)
                    {
                        GameController.GameState = GameState.EndingGame;
                        SwinGame.PlaySoundEffect(UIController.GameSound("endgame"));
                    }

                    GameController.HandleUserInput();
                    GameController.Board.GenerateBlock2();
                }

                if (GameController.GameState == GameState.ViewingHighScore)
                {
                    UIController.DrawRanking();
                    HighScore.DrawHighScores();
                    GameController.HandleRankinginput();
                }


                //if the game ends, show the final score page
                if (GameController.GameState == GameState.EndingGame)
                {
                    UIController.DrawEndGame();
                    HighScore.ReadUserScore(GameController.Board.Score);


                    //GameController.HandleUserInput ();
                    //GameController.HandleEndOfGameInput ();

                    //HighScore.ReadUserScore (GameController.Board.Score);
                }

                if (GameController.GameState == GameState.EndingRanking)
                {
                    UIController.DrawEndRanking();
                    HighScore.DrawHighScores();
                    GameController.HandleEndOfGameInput();
                }

                SwinGame.RefreshScreen(60);
                SwinGame.UpdateAllSprites();
            }

            UIController.FreeResources();
        }