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() { //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(); }