MCPcopy Create free account
hub / github.com/brain-workshop/brainworkshop / create_batch

Method create_batch

brainworkshop.py:1594–1835  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1592 self.batch.draw()
1593
1594 def create_batch(self):
1595 self.batch = pyglet.graphics.Batch()
1596
1597 linecolor = (0, 0, 255)
1598 linecolor2 = (255, 0, 0)
1599 if cfg.BLACK_BACKGROUND:
1600 axiscolor = (96, 96, 96)
1601 minorcolor = (64, 64, 64)
1602 else:
1603 axiscolor = (160, 160, 160)
1604 minorcolor = (224, 224, 224)
1605 y_marking_interval = 0.25 # This doesn't need scaling
1606 x_label_width = 20 # TODO does this need to be scaled too?
1607
1608 height = int(window.height * 0.625)
1609 width = int(window.width * 0.625)
1610 center_x = width_center()
1611 center_y = from_height_center(20)
1612 left = center_x - width // 2
1613 right = center_x + width // 2
1614 top = center_y + height // 2
1615 bottom = center_y - height // 2
1616 try:
1617 dictionary = self.dictionaries[self.graph]
1618 except:
1619 print(self.graph)
1620 graph_title = mode.long_mode_names[self.graph] + _(' N-Back')
1621
1622 if have_shapes:
1623 pyglet.shapes.Line(left, top, left, bottom, color=axiscolor, batch=self.batch)
1624 pyglet.shapes.Line(left, bottom, right, bottom, color=axiscolor, batch=self.batch)
1625 else:
1626 self.batch.add(3, pyglet.gl.GL_LINE_STRIP,
1627 pyglet.graphics.OrderedGroup(order=1), ('v2i', (
1628 left, top,
1629 left, bottom,
1630 right, bottom)), ('c3B', axiscolor * 3))
1631
1632 pyglet.text.Label(
1633 _('G: Return to Main Screen\n\nN: Next Game Type'),
1634 batch=self.batch,
1635 multiline = True, width = scale_to_width(300),
1636 font_size=calc_fontsize(9),
1637 color=cfg.COLOR_TEXT,
1638 x=from_left_edge(10), y=from_top_edge(10),
1639 anchor_x='left', anchor_y='top')
1640
1641 pyglet.text.Label(graph_title,
1642 batch=self.batch,
1643 font_size=calc_fontsize(18), bold=True, color=cfg.COLOR_TEXT,
1644 x = center_x, y = top + scale_to_height(60),
1645 anchor_x = 'center', anchor_y = 'center')
1646
1647 pyglet.text.Label(_('Date'),
1648 batch=self.batch,
1649 font_size=calc_fontsize(12), bold=True, color=cfg.COLOR_TEXT,
1650 x = center_x, y = bottom - scale_to_height(80),
1651 anchor_x = 'center', anchor_y = 'center')

Callers 1

drawMethod · 0.95

Calls 8

width_centerFunction · 0.85
from_height_centerFunction · 0.85
scale_to_widthFunction · 0.85
calc_fontsizeFunction · 0.85
from_left_edgeFunction · 0.85
from_top_edgeFunction · 0.85
scale_to_heightFunction · 0.85
tickMethod · 0.80

Tested by

no test coverage detected