4 void puButton::draw ( int dx, int dy )
6 if ( !visible ) return ;
8 /* If button is pushed or highlighted - use inverse style for button itself */
10 abox . draw ( dx, dy, ( getValue() ^ highlighted ) ? -style : style, colour,
13 /* If greyed out then halve the opacity when drawing the label and legend */
16 glColor4fv ( colour [ PUCOL_LEGEND ] ) ;
18 glColor4f ( colour [ PUCOL_LEGEND ][0],
19 colour [ PUCOL_LEGEND ][1],
20 colour [ PUCOL_LEGEND ][2],
21 colour [ PUCOL_LEGEND ][3] / 2.0 ) ; /* 50% more transparent */
23 int xx = ( abox.max[0] - abox.min[0] - puGetStringWidth(legendFont,legend) ) / 2 ;
24 int yy = ( abox.max[1] - abox.min[1] - puGetStringHeight(legendFont) ) / 2 ;
26 puDrawString ( legendFont, legend,
27 dx + abox.min[0] + xx,
28 dy + abox.min[1] + yy ) ;
30 draw_label ( dx, dy ) ;
34 void puButton::doHit ( int button, int updown, int, int )
36 if ( button == PU_LEFT_BUTTON )
38 if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN )
41 setValue ( (int) ! getValue () ) ;