Esempio n. 1
0
class ModalWindow(Panel):
    
    FPS = 30
    
    def __init__(self, pos, size):
        self.event_system = EventSystem()
        Panel.__init__(self, pos, size, self.event_system)
        
        self.stop = False
        
    def run(self):
        clock = pygame.time.Clock()
        surface = pygame.display.get_surface()
        render_system.add(self, layer=LayerTypes.UI_LAYER)
        
        while not self.stop:
            self.handle_events()
            self.handle_updates(surface)
            
            pygame.display.flip()
            clock.tick(ModalWindow.FPS)
        
        self.kill()
            
    def handle_events(self):
        for event in pygame.event.get():
            if event.type == QUIT:
                sys.exit(0)
            
            self.event_system.process(event)

    def handle_updates(self, surface):
        render_system.update()
        render_system.draw(surface)
Esempio n. 2
0
 def __init__(self, pos, size):
     self.event_system = EventSystem()
     Panel.__init__(self, pos, size, self.event_system)
     
     self.stop = False