MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / game_loop

Function game_loop

PythonAPI/examples/manual_control_steeringwheel.py:771–802  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

769
770
771def 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# ==============================================================================

Callers 1

mainFunction · 0.70

Calls 9

set_timeoutMethod · 0.95
parse_eventsMethod · 0.95
tickMethod · 0.95
renderMethod · 0.95
destroyMethod · 0.95
DualControlClass · 0.85
HUDClass · 0.70
WorldClass · 0.70
ClientMethod · 0.45

Tested by

no test coverage detected