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

Method __init__

PythonAPI/examples/manual_control.py:652–665  ·  view source on GitHub ↗
(self, font, width, height)

Source from the content-addressed store, hash-verified

650class HelpText(object):
651 """Helper class to handle text output using pygame"""
652 def __init__(self, font, width, height):
653 lines = __doc__.split('\n')
654 self.font = font
655 self.line_space = 18
656 self.dim = (780, len(lines) * self.line_space + 12)
657 self.pos = (0.5 * width - 0.5 * self.dim[0], 0.5 * height - 0.5 * self.dim[1])
658 self.seconds_left = 0
659 self.surface = pygame.Surface(self.dim)
660 self.surface.fill((0, 0, 0, 0))
661 for n, line in enumerate(lines):
662 text_texture = self.font.render(line, True, (255, 255, 255))
663 self.surface.blit(text_texture, (22, n * self.line_space))
664 self._render = False
665 self.surface.set_alpha(220)
666
667 def toggle(self):
668 self._render = not self._render

Callers

nothing calls this directly

Calls 1

renderMethod · 0.45

Tested by

no test coverage detected