(args)
| 769 | |
| 770 | |
| 771 | def game_loop(args): |
| 772 | pygame.init() |
| 773 | pygame.font.init() |
| 774 | world = None |
| 775 | |
| 776 | try: |
| 777 | client = carla.Client(args.host, args.port) |
| 778 | client.set_timeout(2.0) |
| 779 | |
| 780 | display = pygame.display.set_mode( |
| 781 | (args.width, args.height), |
| 782 | pygame.HWSURFACE | pygame.DOUBLEBUF) |
| 783 | |
| 784 | hud = HUD(args.width, args.height) |
| 785 | world = World(client.get_world(), hud, args.filter) |
| 786 | controller = DualControl(world, args.autopilot) |
| 787 | |
| 788 | clock = pygame.time.Clock() |
| 789 | while True: |
| 790 | clock.tick_busy_loop(60) |
| 791 | if controller.parse_events(world, clock): |
| 792 | return |
| 793 | world.tick(clock) |
| 794 | world.render(display) |
| 795 | pygame.display.flip() |
| 796 | |
| 797 | finally: |
| 798 | |
| 799 | if world is not None: |
| 800 | world.destroy() |
| 801 | |
| 802 | pygame.quit() |
| 803 | |
| 804 | |
| 805 | # ============================================================================== |
no test coverage detected