MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / render

Method render

examples/space_invaders/space_invaders.py:146–170  ·  view source on GitHub ↗

Render the Glyph at this position.

(self, window, state)

Source from the content-addressed store, hash-verified

144 session.add(self)
145
146 def render(self, window, state):
147 """Render the Glyph at this position."""
148
149 col = 0
150 row = 0
151 glyph = self.glyph
152 data = glyph.glyph_for_state(self, state)
153 for color, char in [
154 (data[i], data[i + 1]) for i in range(0, len(data), 2)
155 ]:
156 x = self.x + col
157 y = self.y + row
158 if 0 <= x <= MAX_X and 0 <= y <= MAX_Y:
159 window.addstr(
160 y + VERT_PADDING,
161 x + HORIZ_PADDING,
162 char,
163 _COLOR_PAIRS[color],
164 )
165 col += 1
166 if col == glyph.width:
167 col = 0
168 row += 1
169 if self.label:
170 self._render_label(window, False)
171
172 def _render_label(self, window, blank):
173 label = self.label if not blank else " " * len(self.label)

Callers 3

render_messageFunction · 0.95
drawFunction · 0.80
update_splatFunction · 0.80

Calls 2

_render_labelMethod · 0.95
glyph_for_stateMethod · 0.45

Tested by

no test coverage detected