@@ -1619,11 +1619,15 @@ def create_batch(self):
16191619 print (self .graph )
16201620 graph_title = mode .long_mode_names [self .graph ] + _ (' N-Back' )
16211621
1622- self .batch .add (3 , pyglet .gl .GL_LINE_STRIP ,
1623- pyglet .graphics .OrderedGroup (order = 1 ), ('v2i' , (
1624- left , top ,
1625- left , bottom ,
1626- right , bottom )), ('c3B' , axiscolor * 3 ))
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 ))
16271631
16281632 pyglet .text .Label (
16291633 _ ('G: Return to Main Screen\n \n N: Next Game Type' ),
@@ -1726,14 +1730,18 @@ def create_batch(self):
17261730 font_size = calc_fontsize (8 ), bold = True , color = cfg .COLOR_TEXT ,
17271731 x = x , y = bottom - scale_to_height (15 ),
17281732 anchor_x = 'center' , anchor_y = 'top' )
1729- self .batch .add (2 , pyglet .gl .GL_LINES ,
1730- pyglet .graphics .OrderedGroup (order = 0 ), ('v2i' , (
1731- x , bottom ,
1732- x , top )), ('c3B' , minorcolor * 2 ))
1733- self .batch .add (2 , pyglet .gl .GL_LINES ,
1734- pyglet .graphics .OrderedGroup (order = 1 ), ('v2i' , (
1735- x , bottom - scale_to_height (10 ),
1736- x , bottom )), ('c3B' , axiscolor * 2 ))
1733+ if have_shapes :
1734+ pyglet .shapes .Line (x , bottom , x , top , color = minorcolor , batch = self .batch )
1735+ pyglet .shapes .Line (x , bottom - scale_to_height (10 ), x , bottom , color = minorcolor , batch = self .batch )
1736+ else :
1737+ self .batch .add (2 , pyglet .gl .GL_LINES ,
1738+ pyglet .graphics .OrderedGroup (order = 0 ), ('v2i' , (
1739+ x , bottom ,
1740+ x , top )), ('c3B' , minorcolor * 2 ))
1741+ self .batch .add (2 , pyglet .gl .GL_LINES ,
1742+ pyglet .graphics .OrderedGroup (order = 1 ), ('v2i' , (
1743+ x , bottom - scale_to_height (10 ),
1744+ x , bottom )), ('c3B' , axiscolor * 2 ))
17371745
17381746 if preventMusicSkipping : pyglet .clock .tick (poll = True ) # Prevent music skipping 2
17391747
@@ -1745,24 +1753,32 @@ def create_batch(self):
17451753 font_size = calc_fontsize (10 ), bold = False , color = cfg .COLOR_TEXT ,
17461754 x = left - scale_to_width (30 ), y = y + scale_to_width (1 ),
17471755 anchor_x = 'center' , anchor_y = 'center' )
1748- self .batch .add (2 , pyglet .gl .GL_LINES ,
1749- pyglet .graphics .OrderedGroup (order = 0 ), ('v2i' , (
1750- left , y ,
1751- right , y )), ('c3B' , minorcolor * 2 ))
1752- self .batch .add (2 , pyglet .gl .GL_LINES ,
1753- pyglet .graphics .OrderedGroup (order = 1 ), ('v2i' , (
1754- left - scale_to_width (10 ), y ,
1755- left , y )), ('c3B' , axiscolor * 2 ))
1756+ if have_shapes :
1757+ pyglet .shapes .Line (left , y , right , y , color = minorcolor , batch = self .batch )
1758+ pyglet .shapes .Line (left - scale_to_width (10 ), y , left , y , color = minorcolor , batch = self .batch )
1759+ else :
1760+ self .batch .add (2 , pyglet .gl .GL_LINES ,
1761+ pyglet .graphics .OrderedGroup (order = 0 ), ('v2i' , (
1762+ left , y ,
1763+ right , y )), ('c3B' , minorcolor * 2 ))
1764+ self .batch .add (2 , pyglet .gl .GL_LINES ,
1765+ pyglet .graphics .OrderedGroup (order = 1 ), ('v2i' , (
1766+ left - scale_to_width (10 ), y ,
1767+ left , y )), ('c3B' , axiscolor * 2 ))
17561768 y_marking += y_marking_interval
17571769
1758- self .batch .add (len (avgpoints ) // 2 , pyglet .gl .GL_LINE_STRIP ,
1759- pyglet .graphics .OrderedGroup (order = 2 ), ('v2i' ,
1760- avgpoints ),
1761- ('c3B' , linecolor * (len (avgpoints ) // 2 )))
1762- self .batch .add (len (maxpoints ) // 2 , pyglet .gl .GL_LINE_STRIP ,
1763- pyglet .graphics .OrderedGroup (order = 3 ), ('v2i' ,
1764- maxpoints ),
1765- ('c3B' , linecolor2 * (len (maxpoints ) // 2 )))
1770+ if have_shapes :
1771+ for index in range (len (avgpoints ) // 2 - 1 ):
1772+ pyglet .shapes .Line (avgpoints [index ], avgpoints [index + 1 ], avgpoints [index + 2 ], avgpoints [index + 3 ], batch = self .batch )
1773+ else :
1774+ self .batch .add (len (avgpoints ) // 2 , pyglet .gl .GL_LINE_STRIP ,
1775+ pyglet .graphics .OrderedGroup (order = 2 ), ('v2i' ,
1776+ avgpoints ),
1777+ ('c3B' , linecolor * (len (avgpoints ) // 2 )))
1778+ self .batch .add (len (maxpoints ) // 2 , pyglet .gl .GL_LINE_STRIP ,
1779+ pyglet .graphics .OrderedGroup (order = 3 ), ('v2i' ,
1780+ maxpoints ),
1781+ ('c3B' , linecolor2 * (len (maxpoints ) // 2 )))
17661782
17671783 if preventMusicSkipping : pyglet .clock .tick (poll = True ) # Prevent music skipping 3
17681784
@@ -1771,24 +1787,30 @@ def create_batch(self):
17711787 for index in range (0 , len (avgpoints ) // 2 ):
17721788 x = avgpoints [index * 2 ]
17731789 avg = avgpoints [index * 2 + 1 ]
1774- max = maxpoints [index * 2 + 1 ]
1790+ maxp = maxpoints [index * 2 + 1 ]
17751791 # draw average
1776- self .batch .add (4 , pyglet .gl .GL_POLYGON ,
1777- pyglet .graphics .OrderedGroup (order = o ), ('v2i' ,
1778- (x - radius , avg - radius ,
1779- x - radius , avg + radius ,
1780- x + radius , avg + radius ,
1781- x + radius , avg - radius )),
1782- ('c3B' , linecolor * 4 ))
1792+ if have_shapes :
1793+ pyglet .shapes .Polygon ((x - radius , avg - radius ), (x - radius , avg + radius ), (x + radius , avg + radius ), (x + radius , avg - radius ), color = linecolor , batch = self .batch )
1794+ else :
1795+ self .batch .add (4 , pyglet .gl .GL_POLYGON ,
1796+ pyglet .graphics .OrderedGroup (order = o ), ('v2i' ,
1797+ (x - radius , avg - radius ,
1798+ x - radius , avg + radius ,
1799+ x + radius , avg + radius ,
1800+ x + radius , avg - radius )),
1801+ ('c3B' , linecolor * 4 ))
17831802 o += 1
17841803 # draw maximum
1785- self .batch .add (4 , pyglet .gl .GL_POLYGON ,
1786- pyglet .graphics .OrderedGroup (order = o ), ('v2i' ,
1787- (x - radius , max - radius ,
1788- x - radius , max + radius ,
1789- x + radius , max + radius ,
1790- x + radius , max - radius )),
1791- ('c3B' , linecolor2 * 4 ))
1804+ if have_shapes :
1805+ pyglet .shapes .Polygon ((x - radius , maxp - radius ), (x - radius , maxp + radius ), (x + radius , maxp + radius ), (x + radius , maxp - radius ), color = linecolor , batch = self .batch )
1806+ else :
1807+ self .batch .add (4 , pyglet .gl .GL_POLYGON ,
1808+ pyglet .graphics .OrderedGroup (order = o ), ('v2i' ,
1809+ (x - radius , maxp - radius ,
1810+ x - radius , maxp + radius ,
1811+ x + radius , maxp + radius ,
1812+ x + radius , maxp - radius )),
1813+ ('c3B' , linecolor2 * 4 ))
17921814 o += 1
17931815
17941816 if preventMusicSkipping : pyglet .clock .tick (poll = True ) # Prevent music skipping 4
@@ -1959,8 +1981,11 @@ def __init__(self, options, values=None, actions={}, names={}, title='',
19591981 anchor_x = 'left' , anchor_y = 'center' , font_name = self .fontlist )
19601982 for i in range (self .pagesize )]
19611983
1962- self .marker = self .batch .add (3 , pyglet .gl .GL_POLYGON , None , ('v2i' , (0 ,)* 6 ,),
1963- ('c3B' , self .markercolors ))
1984+ if have_shapes :
1985+ self .marker = pyglet .shapes .Polygon ((0 ,0 ), (0 ,0 ), (0 ,0 ), color = [1 ] * 3 , batch = self .batch )
1986+ else :
1987+ self .marker = self .batch .add (3 , pyglet .gl .GL_POLYGON , None , ('v2i' , (0 ,)* 6 ,),
1988+ ('c3B' , self .markercolors ))
19641989
19651990 self .update_labels ()
19661991
0 commit comments