Exemplo n.º 1
0
    def main(self):

        # Run main loop
        # FileImporter.play_music("media/music/intro_music/Kontrabandz-Get Down-kissvk.com.mp3", -1)
        #  FileImporter.play_music("media/music/Get_Down.wav", -1)

        while True:
            # Lock frame rate at 60 FPS
            try:
                self.clock.tick(60)
                EventQueue.fill_queue()
                self.screen.fill(Color.BLACK)

                for event in EventQueue.get_instance():
                    if event.type == pygame.QUIT:
                        Networking.get_instance().disconnect()

                        sys.exit()

                # Clear the screen to black
                self.screen.fill(Color.BLACK)

                SceneManager.draw()
                SceneManager.update(EventQueue.get_instance())

                EventQueue.flush_queue()

                pygame.display.flip()
            except Exception as e:
                info = sys.exc_info()
                logger.error("Exception was raised! Continuing, even though we might be screwed.")
                traceback.print_exception(*info)
Exemplo n.º 2
0
    def is_clicked(self):
        if not self.hover():
            return False

        for event in EventQueue.get_instance():
            if event.type == pygame.MOUSEBUTTONUP and event.button == 1:
                return True
        return False