MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / make_surface

Method make_surface

scenario_runner/no_rendering_mode.py:400–413  ·  view source on GitHub ↗
(tl)

Source from the content-addressed store, hash-verified

398
399 def __init__(self):
400 def make_surface(tl):
401 w = 40
402 surface = pygame.Surface((w, 3 * w), pygame.SRCALPHA)
403 surface.fill(COLOR_ALUMINIUM_5 if tl != 'h' else COLOR_ORANGE_2)
404 if tl != 'h':
405 hw = int(w / 2)
406 off = COLOR_ALUMINIUM_4
407 red = COLOR_SCARLET_RED_0
408 yellow = COLOR_BUTTER_0
409 green = COLOR_CHAMELEON_0
410 pygame.draw.circle(surface, red if tl == tls.Red else off, (hw, hw), int(0.4 * w))
411 pygame.draw.circle(surface, yellow if tl == tls.Yellow else off, (hw, w + hw), int(0.4 * w))
412 pygame.draw.circle(surface, green if tl == tls.Green else off, (hw, 2 * w + hw), int(0.4 * w))
413 return pygame.transform.smoothscale(surface, (15, 45) if tl != 'h' else (19, 49))
414 self._original_surfaces = {
415 'h': make_surface('h'),
416 tls.Red: make_surface(tls.Red),

Callers 2

run_interfaceMethod · 0.80
runMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected