<s> import sys <EOL> sys . path . append ( '<STR_LIT>' ) <EOL> import bgui <EOL> import bge <EOL> class MySys ( bgui . System ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , viewport ) : <EOL> bgui . System . __init__ ( self , '<STR_LIT>' ) <EOL> self . frame = bgui . Frame ( self , border = <NUM_LIT:0> , size = viewport [ <NUM_LIT:2> : ] , pos = viewport [ : <NUM_LIT:2> ] ) <EOL> self . frame . colors = [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ] * <NUM_LIT:4> <EOL> self . win = bgui . Frame ( self . frame , size = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> options = bgui . BGUI_DEFAULT | bgui . BGUI_CENTERED ) <EOL> self . win . img = bgui . Image ( self . win , '<STR_LIT>' , size = [ <NUM_LIT> , <NUM_LIT> ] , pos = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> options = bgui . BGUI_DEFAULT | bgui . BGUI_CENTERX | bgui . BGUI_CACHE ) <EOL> self . button = bgui . FrameButton ( self . win , text = '<STR_LIT>' , size = [ <NUM_LIT> , <NUM_LIT> ] , pos = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> options = bgui . BGUI_DEFAULT ) <EOL> self . button . on_click = self . on_img_click <EOL> self . lbl = bgui . Label ( self . frame , text = "<STR_LIT>" , pos = [ <NUM_LIT:0> , <NUM_LIT> ] , <EOL> sub_theme = '<STR_LIT>' , options = bgui . BGUI_DEFAULT | bgui . BGUI_CENTERX ) <EOL> self . progress = bgui . ProgressBar ( self . win , percent = <NUM_LIT:0.0> , size = [ <NUM_LIT> , <NUM_LIT> ] , pos = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> sub_theme = "<STR_LIT>" , options = bgui . BGUI_DEFAULT | bgui . BGUI_CENTERX ) <EOL> self . health = bgui . ProgressBar ( self . win , percent = <NUM_LIT:0.5> , size = [ <NUM_LIT> , <NUM_LIT> ] , pos = [ <NUM_LIT:0> , <NUM_LIT> ] , <EOL> sub_theme = "<STR_LIT>" , options = bgui . BGUI_DEFAULT | bgui . BGUI_CENTERX ) <EOL> self . input = bgui . TextInput ( self . win , text = "<STR_LIT>" , font = "<STR_LIT>" , size = [ <NUM_LIT> , <NUM_LIT> ] , pos = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> input_options = bgui . BGUI_INPUT_NONE , options = bgui . BGUI_DEFAULT ) <EOL> self . input . activate ( ) <EOL> self . input . on_enter_key = self . on_input_enter <EOL> self . input2 = bgui . TextInput ( self . win , text = "<STR_LIT>" , size = [ <NUM_LIT> , <NUM_LIT> ] , pos = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> input_options = bgui . BGUI_INPUT_SELECT_ALL , options = bgui . BGUI_DEFAULT ) <EOL> self . counter = <NUM_LIT:0> <EOL> self . keymap = { getattr ( bge . events , val ) : getattr ( bgui , val ) for val in dir ( bge . events ) if val . endswith ( '<STR_LIT>' ) or val . startswith ( '<STR_LIT>' ) } <EOL> bge . logic . getCurrentScene ( ) . post_draw . append ( self . render ) <EOL> def on_input_enter ( self , widget ) : <EOL> self . lbl . text = "<STR_LIT>" + widget . text <EOL> widget . text = "<STR_LIT>" <EOL> widget . deactivate ( ) <EOL> widget . frozen = <NUM_LIT:1> <EOL> def on_img_click ( self , widget ) : <EOL> print ( "<STR_LIT>" ) <EOL> self . counter += <NUM_LIT:1> <EOL> self . lbl . text = "<STR_LIT>" % self . counter <EOL> self . progress . percent += <NUM_LIT> <EOL> if self . counter % <NUM_LIT:2> == <NUM_LIT:1> : <EOL> self . win . img . texco = [ ( <NUM_LIT:1> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:1> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) ] <EOL> else : <EOL> self . win . img . texco = [ ( <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:1> , <NUM_LIT:0> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:0> , <NUM_LIT:1> ) ] <EOL> def main ( self ) : <EOL> """<STR_LIT>""" <EOL> mouse = bge . logic . mouse <EOL> pos = list ( mouse . position ) <EOL> pos [ <NUM_LIT:0> ] *= bge . render . getWindowWidth ( ) <EOL> pos [ <NUM_LIT:1> ] = bge . render . getWindowHeight ( ) - ( bge . render . getWindowHeight ( ) * pos [ <NUM_LIT:1> ] ) <EOL> mouse_state = bgui . BGUI_MOUSE_NONE <EOL> mouse_events = mouse . events <EOL> if mouse_events [ bge . events . LEFTMOUSE ] == bge . logic . KX_INPUT_JUST_ACTIVATED : <EOL> mouse_state = bgui . BGUI_MOUSE_CLICK <EOL> elif mouse_events [ bge . events . LEFTMOUSE ] == bge . logic . KX_INPUT_JUST_RELEASED : <EOL> mouse_state = bgui . BGUI_MOUSE_RELEASE <EOL> elif mouse_events [ bge . events . LEFTMOUSE ] == bge . logic . KX_INPUT_ACTIVE : <EOL> mouse_state = bgui . BGUI_MOUSE_ACTIVE <EOL> self . update_mouse ( pos , mouse_state ) <EOL> keyboard = bge . logic . keyboard <EOL> key_events = keyboard . events <EOL> is_shifted = key_events [ bge . events . LEFTSHIFTKEY ] == bge . logic . KX_INPUT_ACTIVE or key_events [ bge . events . RIGHTSHIFTKEY ] == bge . logic . KX_INPUT_ACTIVE <EOL> for key , state in keyboard . events . items ( ) : <EOL> if state == bge . logic . KX_INPUT_JUST_ACTIVATED : <EOL> self . update_keyboard ( self . keymap [ key ] , is_shifted ) <EOL> def main ( cont ) : <EOL> own = cont . owner <EOL> mouse = bge . logic . mouse <EOL> if '<STR_LIT>' not in own : <EOL> ob_list = bge . logic . getCurrentScene ( ) . objects <EOL> x = bge . render . getWindowWidth ( ) <EOL> y = bge . render . getWindowHeight ( ) <EOL> cam = ob_list [ '<STR_LIT>' ] <EOL> cam . useViewport = True <EOL> cam . setViewport ( <NUM_LIT:0> , <NUM_LIT:0> , x // <NUM_LIT:2> , y ) <EOL> cam = ob_list [ '<STR_LIT>' ] <EOL> cam . useViewport = True <EOL> cam . setViewport ( x // <NUM_LIT:2> , <NUM_LIT:0> , x , y ) <EOL> own [ '<STR_LIT>' ] = MySys ( [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0.5> , <NUM_LIT:1> ] ) <EOL> own [ '<STR_LIT>' ] = MySys ( [ <NUM_LIT:0.5> , <NUM_LIT:0> , <NUM_LIT:0.5> , <NUM_LIT:1> ] ) <EOL> mouse . visible = True <EOL> else : <EOL> own [ '<STR_LIT>' ] . main ( ) <EOL> own [ '<STR_LIT>' ] . main ( ) </s>
