<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> autotest = <NUM_LIT:0> <EOL> import cocos <EOL> from cocos . director import director <EOL> from cocos . sprite import Sprite <EOL> from cocos import draw <EOL> from cocos . actions import Delay , CallFunc <EOL> import pyglet <EOL> import random <EOL> ri = random . randint <EOL> class TestFigure ( draw . Canvas ) : <EOL> def render ( self ) : <EOL> x , y = director . get_window_size ( ) <EOL> ys = y // <NUM_LIT:4> <EOL> ye = ys * <NUM_LIT:3> <EOL> xs = x // <NUM_LIT:4> <EOL> line_width = <NUM_LIT:50> <EOL> self . set_color ( ( <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:0> , <NUM_LIT> ) ) <EOL> self . set_stroke_width ( line_width ) <EOL> self . set_endcap ( draw . ROUND_CAP ) <EOL> self . move_to ( ( x // <NUM_LIT:2> , y // <NUM_LIT:2> - line_width // <NUM_LIT:2> ) ) ; self . line_to ( ( x // <NUM_LIT:2> - <NUM_LIT> , y // <NUM_LIT:2> - <NUM_LIT> ) ) <EOL> class TestLayer ( cocos . layer . Layer ) : <EOL> is_event_handler = True <EOL> def __init__ ( self ) : <EOL> super ( TestLayer , self ) . __init__ ( ) <EOL> self . add ( TestFigure ( ) ) <EOL> self . schedule ( lambda x : <NUM_LIT:0> ) <EOL> if autotest : <EOL> self . do ( Delay ( <NUM_LIT:1.0> ) + CallFunc ( self . upscale ) + <EOL> Delay ( <NUM_LIT:1.0> ) + CallFunc ( self . upscale ) ) <EOL> def on_key_press ( self , k , mod ) : <EOL> self . upscale ( ) <EOL> def upscale ( self ) : <EOL> self . scale += <NUM_LIT:1> <EOL> def main ( ) : <EOL> director . init ( ) <EOL> test_layer = TestLayer ( ) <EOL> main_scene = cocos . scene . Scene ( test_layer ) <EOL> director . run ( main_scene ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
