<s> import math <EOL> import pyglet <EOL> from pyglet . gl import * <EOL> class SmoothLineGroup ( pyglet . graphics . Group ) : <EOL> def set_state ( self ) : <EOL> glPushAttrib ( GL_ENABLE_BIT ) <EOL> glEnable ( GL_BLEND ) <EOL> glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) <EOL> glEnable ( GL_LINE_SMOOTH ) <EOL> glLineWidth ( <NUM_LIT:2> ) <EOL> def unset_state ( self ) : <EOL> glPopAttrib ( ) <EOL> def __hash__ ( self ) : <EOL> return hash ( self . __class__ . __name__ ) <EOL> def __eq__ ( self , other ) : <EOL> return self . __class__ is other . __class__ <EOL> def add_circle ( batch , x , y , radius , color , num_points = <NUM_LIT:20> , antialised = True ) : <EOL> l = [ ] <EOL> for n in range ( num_points ) : <EOL> angle = ( math . pi * <NUM_LIT:2> * n ) / num_points <EOL> l . append ( int ( x + radius * math . cos ( angle ) ) ) <EOL> l . append ( int ( y + radius * math . sin ( angle ) ) ) <EOL> l . append ( int ( x + radius * <NUM_LIT:1> ) ) <EOL> l . append ( int ( y ) ) <EOL> num_points += <NUM_LIT:3> <EOL> l [ <NUM_LIT:0> : <NUM_LIT:0> ] = l [ <NUM_LIT:0> : <NUM_LIT:2> ] <EOL> l . extend ( l [ - <NUM_LIT:2> : ] ) <EOL> if antialised : <EOL> group = SmoothLineGroup ( ) <EOL> else : <EOL> group = None <EOL> return batch . add ( num_points , GL_LINE_STRIP , group , ( '<STR_LIT>' , l ) , <EOL> ( '<STR_LIT>' , color * num_points ) ) </s>
