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

Function game_loop

PythonAPI/examples/manual_control_rss.py:871–905  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

869
870
871def game_loop(args):
872 pygame.init()
873 pygame.font.init()
874 world = None
875
876 try:
877 client = carla.Client(args.host, args.port)
878 client.set_timeout(2.0)
879
880 display = pygame.display.set_mode(
881 (args.width, args.height),
882 pygame.HWSURFACE | pygame.DOUBLEBUF)
883
884 hud = HUD(args.width, args.height)
885 world = World(client.get_world(), hud, args.filter, args.rolename)
886 controller = KeyboardControl(world, args)
887
888 clock = pygame.time.Clock()
889 while True:
890 clock.tick_busy_loop(60)
891 if controller.parse_events(client, world, clock):
892 return
893 world.tick(clock)
894 world.render(display)
895 pygame.display.flip()
896
897 finally:
898
899 if (world and world.recording_enabled):
900 client.stop_recorder()
901
902 if world is not None:
903 world.destroy()
904
905 pygame.quit()
906
907
908# ==============================================================================

Callers 1

mainFunction · 0.70

Calls 9

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

Tested by

no test coverage detected