/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { //if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) // this.Exit(); MouseState mouseState = Mouse.GetState(); button.btnMute.Update(mouseState, true); button.btnUnMute.Update(mouseState, true); MuteEvent(); gameState.Update(gameTime); base.Update(gameTime); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { //sets the mouse handle Mouse.WindowHandle = Window.Handle; //loading logic if (!loadingThread.IsAlive) { if ((justFinshed) && (!isDoneLoading)) { save = new SaveGame("C:/Users/" + Environment.UserName + "/Documents/RubikCube/save.xml", "root"); isDoneLoading = true; Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); //should upgrade to DebbugBorders (~~~) but too afraid to StuckOverflow the game. } //load bools from save file foreach (Tuple <string, string> b in save.LoadBools()) { if (b.Item1 == "isFirstTime") { isFirstTime = Convert.ToBoolean(b.Item2); } } // checks if the loading & the Clocks are done if (justFinshed && clocks.CallTimer(gameTime)) { MediaPlayer.Resume(); if (isFirstTime) { save.AddBool("isFirstTime", "false"); } justFinshed = false; } //neccesary updates button.BtnMute.Update(true, gameTime); button.BtnUnMute.Update(true, gameTime); MuteEvent(); gameState.Update(gameTime, GraphicsDevice, music); } else { //loading animation loading.Update(gameTime); //pause media player to prevent bugs if (MediaPlayer.State != MediaState.Paused) { MediaPlayer.Pause(); } } base.Update(gameTime); }