<s> from __future__ import division , print_function , unicode_literals <EOL> import sys <EOL> import os <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:..>' ) ) <EOL> testinfo = "<STR_LIT>" <EOL> tags = "<STR_LIT>" <EOL> from pyglet . gl import * <EOL> import cocos <EOL> from cocos . director import director <EOL> from cocos . actions import Delay , CallFunc , Repeat <EOL> w_ini = <NUM_LIT> <EOL> h_ini = <NUM_LIT> <EOL> assert abs ( w_ini / h_ini - <NUM_LIT:4> / <NUM_LIT> ) < <NUM_LIT> <EOL> class ProbeRect ( cocos . cocosnode . CocosNode ) : <EOL> def __init__ ( self , w_ini , h_ini , color4 ) : <EOL> super ( ProbeRect , self ) . __init__ ( ) <EOL> self . color4 = color4 <EOL> w2 = int ( w_ini // <NUM_LIT:2> ) <EOL> h2 = int ( h_ini // <NUM_LIT:2> ) <EOL> self . vertexes = [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , h_ini , <NUM_LIT:0> ) , ( w_ini , h_ini , <NUM_LIT:0> ) , ( w_ini , <NUM_LIT:0> , <NUM_LIT:0> ) ] <EOL> def draw ( self ) : <EOL> glPushMatrix ( ) <EOL> self . transform ( ) <EOL> glBegin ( GL_QUADS ) <EOL> glColor4ub ( * self . color4 ) <EOL> for v in self . vertexes : <EOL> glVertex3i ( * v ) <EOL> glEnd ( ) <EOL> glPopMatrix ( ) <EOL> class TestLayer ( cocos . layer . Layer ) : <EOL> def __init__ ( self ) : <EOL> super ( TestLayer , self ) . __init__ ( ) <EOL> self . add ( ProbeRect ( w_ini , h_ini , ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:255> ) ) , z = <NUM_LIT:1> ) <EOL> border_size = <NUM_LIT:10> <EOL> inner = ProbeRect ( w_ini - <NUM_LIT:2> * border_size , h_ini - <NUM_LIT:2> * border_size , ( <NUM_LIT:255> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:255> ) ) <EOL> inner . position = ( border_size , border_size ) <EOL> self . add ( inner , z = <NUM_LIT:2> ) <EOL> outer = ProbeRect ( w_ini + <NUM_LIT:2> * border_size , h_ini + <NUM_LIT:2> * border_size , ( <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:0> , <NUM_LIT:255> ) ) <EOL> outer . position = ( - border_size , - border_size ) <EOL> self . add ( outer , z = <NUM_LIT:0> ) <EOL> self . size_from_stage = [ ( <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , <EOL> ( <NUM_LIT> , <NUM_LIT> ) , ( w_ini , h_ini ) ] <EOL> self . stage = <NUM_LIT:0> <EOL> self . do ( Repeat ( Delay ( <NUM_LIT:4> ) + CallFunc ( self . rotate_sizes ) ) ) <EOL> def rotate_sizes ( self ) : <EOL> director . window . set_size ( * self . size_from_stage [ self . stage ] ) <EOL> self . stage = ( self . stage + <NUM_LIT:1> ) % len ( self . size_from_stage ) <EOL> description = """<STR_LIT>""" <EOL> def main ( ) : <EOL> print ( description ) <EOL> director . init ( width = w_ini , height = h_ini , resizable = False ) <EOL> scene = cocos . scene . Scene ( ) <EOL> scene . add ( TestLayer ( ) ) <EOL> director . run ( scene ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
