Esempio n. 1
0
 def update(self):
     '''
     @brief Método que actualiza lógicamente el menú
     Solo actualiza los elementos de la capa actual
     '''
     self.actual_option = None
     #Actualizamos cada uno de los botones, por defecto del menú
     for button in self.buttons:
         button.update()
         #Si el cursor está sobre alguno de los botones
         if button.get_selected():
             #Obtenemos su opción
             self.actual_option = button.get_option()
     
     #Actualizamos los botones de las capas
     for button in self.buttons_layers[self.actual_layer]:
         button.update()
         if button.get_selected():
             self.actual_option = button.get_option()
     
     #Si hay algun botón seleccionado
     if self.actual_option:
         #Cambiamos el cursor
         self.cursor.over()
             
     #Si no, lo dejamos normal
     else:
         self.cursor.normal()
     
     #Actualizamos el cursor
     self.cursor.update()
Esempio n. 2
0
    def update(self):
        
        self.actual_option = None
        for button in self.buttons:
            button.update()
            if button.get_selected():
                self.actual_option = button.get_option()
        
        if self.actual_option:
            self.cursor.over()
        else:
            self.cursor.normal()
        
        self.cursor.update()

        if pygame.mouse.get_pressed()[0]:
            self.treat_option()
Esempio n. 3
0
    def update(self):
        
        self.actual_option = None
        number = 0
        for button in self.buttons:
            button.update()
            number += 1
            if button.get_selected():
                self.actual_option = button.get_option()
        
        if self.actual_option:
            self.cursor.over()
        else:
            self.cursor.normal()
        
        for element in self.elements_layers[self.actual_layer]:
            element.update()
        
        self.cursor.update()

        if pygame.mouse.get_pressed()[0]:
            self.treat_option()
Esempio n. 4
0
 def run(self):
     '''
     Función que contiene el bucle principal del juego.
     Actualiza y dibuja el estado actual.
     '''
     while not keyboard.quit():
         
         self.clock.tick(self.fps)
         
         keyboard.update()
         
         for button in self.buttons:
             button.update()
             if button.get_selected() and pygame.mouse.get_pressed()[0]:
                 self.treat_option(button.get_option())
         
         self.timer.update()
         self.timer2.update()
         self.timer3.update()
         
         self.screen.fill(THECOLORS['white'])
         
         for button in self.buttons:
             button.draw(self.screen)
             
         self.timer.draw(self.screen)
         self.timer2.draw(self.screen)
         self.timer3.draw(self.screen)
         #self.__actual_state.update()
         #self.__actual_state.draw(screen)
         
         if self.__start and time.time() - self.__start >= 5:
             self.__start = time.time()
             if self.timer2.less_than(self.timer):
                 self.timer2.assign(self.timer)
             elif self.timer2.more_than(self.timer):
                 print "Es mayoooor"
         
         pygame.display.flip()