def update(self): # Determine if we need to move the top of the menu if self.currentSelection <= self.top_of_menu: self.top_of_menu = self.currentSelection - 1 elif self.currentSelection > self.top_of_menu + 4: self.top_of_menu = self.currentSelection - 4 if self.top_of_menu < 0: self.top_of_menu = 0 if self.state.getState() == "Config": if self.top_of_menu > len(self.config) - 6: self.top_of_menu = len(self.config) - 6 elif self.state.getState() == "Controls": if self.top_of_menu > len(self.control_order) - 6: self.top_of_menu = len(self.control_order) - 6 # Handle Cursor currentTime = pygame.time.get_ticks() if currentTime - self.lastUpdate > 50: self.lastUpdate = currentTime self.cursorCounter += 1 self.arrowCounter += 1 if self.cursorCounter > len(self.cursorAnim) - 1: self.cursorCounter = 0 if self.arrowCounter > self.arrowMax: self.arrowCounter = 0 MUSICTHREAD.set_volume(OPTIONS['Music Volume']) imagesDict.set_sound_volume(OPTIONS['Sound Volume'], SOUNDDICT)
def update(self, gameStateObj, metaDataObj): # Determine if we need to move the top of the menu if self.currentSelection <= self.top_of_menu: self.top_of_menu = self.currentSelection - 1 # self.up_arrow.pulse() elif self.currentSelection > self.top_of_menu + 4: self.top_of_menu = self.currentSelection - 4 # self.down_arrow.pulse() if self.top_of_menu < 0: self.top_of_menu = 0 if self.state.getState() == "Config": if self.top_of_menu > len(self.config) - 6: self.top_of_menu = len(self.config) - 6 elif self.state.getState() == "Controls": if self.top_of_menu > len(self.control_order) - 6: self.top_of_menu = len(self.control_order) - 6 # Handle Cursor Counters.CursorControl.update(self) # Update music volume... if cf.OPTIONS['Music Volume'] != Engine.music_thread.get_volume(): Engine.music_thread.set_volume(cf.OPTIONS['Music Volume']) if cf.OPTIONS['Sound Volume'] != imagesDict.sound_volume: imagesDict.set_sound_volume(cf.OPTIONS['Sound Volume'], GC.SOUNDDICT)