<s> """<STR_LIT>""" <EOL> from __future__ import division , print_function , unicode_literals <EOL> __docformat__ = '<STR_LIT>' <EOL> from cocos . director import director <EOL> from cocos . layer import Layer , ColorLayer <EOL> from cocos . scene import Scene <EOL> import pyglet <EOL> from pyglet . gl import * <EOL> __pause_scene_generator__ = None <EOL> def get_pause_scene ( ) : <EOL> return __pause_scene_generator__ ( ) <EOL> def set_pause_scene_generator ( generator ) : <EOL> global __pause_scene_generator__ <EOL> __pause_scene_generator__ = generator <EOL> def default_pause_scene ( ) : <EOL> w , h = director . window . width , director . window . height <EOL> texture = pyglet . image . Texture . create_for_size ( <EOL> GL_TEXTURE_2D , w , h , GL_RGBA ) <EOL> texture . blit_into ( pyglet . image . get_buffer_manager ( ) . get_color_buffer ( ) , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> return PauseScene ( texture . get_region ( <NUM_LIT:0> , <NUM_LIT:0> , w , h ) , <EOL> ColorLayer ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , PauseLayer ( ) ) <EOL> set_pause_scene_generator ( default_pause_scene ) <EOL> class PauseScene ( Scene ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , background , * layers ) : <EOL> super ( PauseScene , self ) . __init__ ( * layers ) <EOL> self . bg = background <EOL> self . width , self . height = director . get_window_size ( ) <EOL> def draw ( self ) : <EOL> self . bg . blit ( <NUM_LIT:0> , <NUM_LIT:0> , width = self . width , height = self . height ) <EOL> super ( PauseScene , self ) . draw ( ) <EOL> class PauseLayer ( Layer ) : <EOL> """<STR_LIT>""" <EOL> is_event_handler = True <EOL> def __init__ ( self ) : <EOL> super ( PauseLayer , self ) . __init__ ( ) <EOL> x , y = director . get_window_size ( ) <EOL> ft = pyglet . font . load ( '<STR_LIT>' , <NUM_LIT> ) <EOL> self . text = pyglet . font . Text ( ft , <EOL> '<STR_LIT>' , <EOL> halign = pyglet . font . Text . CENTER ) <EOL> self . text . x = x // <NUM_LIT:2> <EOL> self . text . y = y // <NUM_LIT:2> <EOL> def draw ( self ) : <EOL> self . text . draw ( ) <EOL> def on_key_press ( self , k , m ) : <EOL> if k == pyglet . window . key . P and m & pyglet . window . key . MOD_ACCEL : <EOL> director . pop ( ) <EOL> return True </s>
