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(); }
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(); }
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(); } }
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(); }
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(); }
public static void Main() { //Open the game window SwinGame.OpenGraphicsWindow("GameMain", 900, 650); GameResources.LoadResources(); SwinGame.PlayMusic("hello.mp3"); MainMenuController myMenu = new MainMenuController(); GameController myGame = new GameController(); SettingController mySetting = new SettingController(); CarSelectionController myCar = new CarSelectionController(); InstructionController myInstruction = new InstructionController(); UtilityFunction.gameStateStack.Push(GameState.ViewingMainPage); Page page = myMenu; //Run the game loop while (false == SwinGame.WindowCloseRequested()) { SwinGame.ProcessEvents(); SwinGame.ClearScreen(Color.White); GameState curPage = UtilityFunction.gameStateStack.Peek(); switch (curPage) { case GameState.ViewingMainPage: page = myMenu; myGame = new GameController(); //clear game status break; case GameState.ViewingGamePage: page = myGame; break; case GameState.GameOverPage: myGame = new GameController(); page = myGame; break; case GameState.ViewingSettingPage: case GameState.ChangingDifficulty: page = mySetting; break; case GameState.ViewingCarSelection: case GameState.ChangingCar: page = myCar; break; case GameState.Instruction: page = myInstruction; break; default: page = new MainMenuController(); break; } page.Execute(); SwinGame.RefreshScreen(60); } SwinGame.DrawFramerate(0, 0); //Draw onto the screen SwinGame.RefreshScreen(60); }