<s> """<STR_LIT>""" <EOL> from panda3d . core import Vec2 , Vec3 , Vec4 <EOL> from panda3d . core import TextNode as TextNodeImpl <EOL> from rpcore . globals import Globals <EOL> from rpcore . rpobject import RPObject <EOL> from rpcore . loader import RPLoader <EOL> class TextNode ( RPObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , font = "<STR_LIT>" , pixel_size = <NUM_LIT:16> , align = "<STR_LIT:left>" , <EOL> pos = Vec2 ( <NUM_LIT:0> ) , color = Vec3 ( <NUM_LIT:1> ) , parent = None ) : <EOL> """<STR_LIT>""" <EOL> RPObject . __init__ ( self ) <EOL> self . _node = TextNodeImpl ( '<STR_LIT>' ) <EOL> self . _node . set_text ( "<STR_LIT>" ) <EOL> self . _node . set_align ( getattr ( TextNodeImpl , "<STR_LIT>" + align ) ) <EOL> self . _node . set_text_color ( color . x , color . y , color . z , <NUM_LIT:1> ) <EOL> if parent is None : <EOL> parent = Globals . base . aspect2d <EOL> self . _nodepath = parent . attach_new_node ( self . _node ) <EOL> self . _nodepath . set_pos ( pos . x , <NUM_LIT:0> , pos . y ) <EOL> font = RPLoader . load_font ( font ) <EOL> font . set_outline ( Vec4 ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> ) , <NUM_LIT> , <NUM_LIT> ) <EOL> font . set_scale_factor ( <NUM_LIT:1.0> ) <EOL> font . set_texture_margin ( int ( pixel_size / <NUM_LIT> * <NUM_LIT> ) ) <EOL> font . set_bg ( Vec4 ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> self . _node . set_font ( font ) <EOL> self . set_pixel_size ( pixel_size ) <EOL> @ property <EOL> def text ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _node . get_text ( ) <EOL> @ text . setter <EOL> def text ( self , text ) : <EOL> """<STR_LIT>""" <EOL> self . _node . set_text ( text ) <EOL> def set_pixel_size ( self , size ) : <EOL> self . _nodepath . set_scale ( size * <NUM_LIT> / float ( Globals . native_resolution . y ) ) </s>
