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

Method render

PythonAPI/examples/manual_control_steeringwheel.py:475–511  ·  view source on GitHub ↗
(self, display)

Source from the content-addressed store, hash-verified

473 self._notifications.set_text('Error: %s' % text, (255, 0, 0))
474
475 def render(self, display):
476 if self._show_info:
477 info_surface = pygame.Surface((220, self.dim[1]))
478 info_surface.set_alpha(100)
479 display.blit(info_surface, (0, 0))
480 v_offset = 4
481 bar_h_offset = 100
482 bar_width = 106
483 for item in self._info_text:
484 if v_offset + 18 > self.dim[1]:
485 break
486 if isinstance(item, list):
487 if len(item) > 1:
488 points = [(x + 8, v_offset + 8 + (1.0 - y) * 30) for x, y in enumerate(item)]
489 pygame.draw.lines(display, (255, 136, 0), False, points, 2)
490 item = None
491 v_offset += 18
492 elif isinstance(item, tuple):
493 if isinstance(item[1], bool):
494 rect = pygame.Rect((bar_h_offset, v_offset + 8), (6, 6))
495 pygame.draw.rect(display, (255, 255, 255), rect, 0 if item[1] else 1)
496 else:
497 rect_border = pygame.Rect((bar_h_offset, v_offset + 8), (bar_width, 6))
498 pygame.draw.rect(display, (255, 255, 255), rect_border, 1)
499 f = (item[1] - item[2]) / (item[3] - item[2])
500 if item[2] < 0.0:
501 rect = pygame.Rect((bar_h_offset + f * (bar_width - 6), v_offset + 8), (6, 6))
502 else:
503 rect = pygame.Rect((bar_h_offset, v_offset + 8), (f * bar_width, 6))
504 pygame.draw.rect(display, (255, 255, 255), rect)
505 item = item[0]
506 if item: # At this point has to be a str.
507 surface = self._font_mono.render(item, True, (255, 255, 255))
508 display.blit(surface, (8, v_offset))
509 v_offset += 18
510 self._notifications.render(display)
511 self.help.render(display)
512
513
514# ==============================================================================

Callers 3

renderMethod · 0.45
set_textMethod · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected