#include "base.h" #include #include void gui_label_draw_fn( void* ptr ) { GUI_LABEL* label = (GUI_LABEL*)ptr; I32 x = gui_relx( label ); I32 y = gui_rely( label ); gui_draw_get_str_bounds( &label->w, &label->h, FNT_JPN12, label->name ); label->xbound = label->w; label->ybound = label->h; gui_draw_str( x, y, ALIGN_L, FNT_JPN12, ui_clr.txt, label->name ); } GUI_LABEL* gui_label( I32 x, I32 y, const char* title, ... ) { if( !gui_check_target() ) return 0; char buf[GUI_NAME_LEN]; va_list args; va_start( args, title ); vsprintf( buf, title, args ); va_end( args ); GUI_LABEL* label = new GUI_LABEL; label->x = x; label->y = y; label->draw_fn = gui_label_draw_fn; strcpy( label->name, buf ); gui_draw_get_str_bounds( &label->w, &label->h, FNT_JPN12, label->name ); label->xbound = label->w; label->ybound = label->h; label->parent = gui_get_view(); label->parent->children.push( label ); return label; }