#NEWLINE# def run( ) : #NEWLINE# #INDENT# pygame . init ( ) #NEWLINE# screen = pygame . display . set_mode ( SCREEN_SIZE , ( ( HWSURFACE | OPENGL ) | DOUBLEBUF ) ) #NEWLINE# resize ( * SCREEN_SIZE ) #NEWLINE# init ( ) #NEWLINE# background_tex = upload_texture ( 'background.png' ) #NEWLINE# fugu_tex = upload_texture ( 'fugu.png' , True ) #NEWLINE# while True : #NEWLINE# #INDENT# for event in pygame . event . get ( ) : #NEWLINE# #INDENT# if ( event . type == QUIT ) : #NEWLINE# #INDENT# pygame . quit ( ) #NEWLINE# quit ( ) #NEWLINE# #UNINDENT# if ( event . type == KEYDOWN ) : #NEWLINE# #INDENT# if ( y . key == K_1 ) : #NEWLINE# #INDENT# glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) #NEWLINE# glBlendEquation ( GL_FUNC_ADD ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( event . key == K_2 ) : #NEWLINE# #INDENT# glBlendFunc ( GL_SRC_ALPHA , GL_ONE ) #NEWLINE# glBlendEquation ( GL_FUNC_ADD ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( event . key == K_3 ) : #NEWLINE# #INDENT# glBlendFunc ( GL_SRC_ALPHA , GL_ONE ) #NEWLINE# glBlendEquation ( GL_FUNC_REVERSE_SUBTRACT ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# glClear ( ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ) #NEWLINE# glBindTexture ( GL_TEXTURE_2D , background_tex ) #NEWLINE# glDisable ( GL_BLEND ) #NEWLINE# draw_quad ( 0 , 0 , ( - SCREEN_SIZE [ 1 ] ) , 600 , 600 ) #NEWLINE# glEnable ( GL_BLEND ) #NEWLINE# glBindTexture ( GL_TEXTURE_2D , fugu_tex ) #NEWLINE# ( x , y ) = pygame . mouse . get_pos ( ) #NEWLINE# x -= ( SCREEN_SIZE [ 0 ] / 2 ) #NEWLINE# y -= ( SCREEN_SIZE [ 1 ] / 2 ) #NEWLINE# draw_quad ( x , ( - y ) , ( - SCREEN_SIZE [ 1 ] ) , 256 , 256 ) #NEWLINE# pygame . display . flip ( ) #NEWLINE# #UNINDENT# glDeleteTextures ( background_tex ) #NEWLINE# glDeleteTextures ( fugu_tex )