5 #ifdef USE_HUD_TextList
6 #define textString( x , y, text, font,digit ) TextString( text, x , y,digit ) //suma
8 #define textString( x , y, text, font,digit ) puDrawString ( guiFnt, text, x, y ); //suma
11 //======================= Top of instr_label class =========================
18 // DBLFNPTR data_source,
19 const char *label_format,
20 const char *pre_label_string,
21 const char *post_label_string,
25 fgLabelJust justification,
30 instr_item( x, y, width, height,
31 data_source, scale_data,options, working,digit ), //suma
32 pformat ( label_format ),
33 pre_str ( pre_label_string ),
34 post_str ( post_label_string ),
35 justify ( justification ),
36 fontSize ( font_size ),
39 if( pre_str != NULL) {
40 if( post_str != NULL ) {
41 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
44 sprintf( format_buffer, "%s%s", pre_str, pformat );
48 if( post_str != NULL ) {
49 sprintf( format_buffer, "%s%s", pformat, post_str );
51 } // else do nothing if both pre and post strings are nulls. Interesting.
55 // I put this in to make it easy to construct a class member using the current
59 lon_label :: ~lon_label()
64 lon_label :: lon_label( const lon_label & image) :
65 instr_item((const instr_item &)image),
66 pformat ( image.pformat ),
67 pre_str ( image.pre_str ),
68 post_str ( image.post_str ),
71 if( pre_str != NULL) {
72 if( post_str != NULL ) {
73 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
76 sprintf( format_buffer, "%s%s", pre_str, pformat );
80 if( post_str != NULL ) {
81 sprintf( format_buffer, "%s%s", pformat, post_str );
83 } // else do nothing if both pre and post strings are nulls. Interesting.
87 lon_label & lon_label ::operator = (const lon_label & rhs )
89 if( !(this == &rhs)) {
90 instr_item::operator = (rhs);
91 pformat = rhs.pformat;
92 fontSize = rhs.fontSize;
94 justify = rhs.justify;
95 pre_str = rhs.pre_str;
96 post_str = rhs.post_str;
97 strcpy(format_buffer,rhs.format_buffer);
103 // draw Draws a label anywhere in the HUD
107 draw( void ) // Required method in base class
109 // char format_buffer[80];
110 char label_buffer[80];
113 RECT scrn_rect = get_location();
114 float lon = get_value();
115 // double lon = get_value();
116 if( data_available() ) {
117 // char *lonstring = coord_format_lon(lon);
118 lenstr = sprintf( label_buffer, format_buffer, coord_format_lon(lon) );
121 lenstr = sprintf( label_buffer, format_buffer );
125 fgPrintf( SG_COCKPIT, SG_DEBUG, format_buffer );
126 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
127 fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
128 fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
131 lenstr = getStringWidth(label_buffer);
133 if( justify == RIGHT_JUST ) {
134 posincr = scrn_rect.right - lenstr;
135 }else if( justify == CENTER_JUST ) {
136 posincr = get_span() - (lenstr/2);
138 // justify == LEFT_JUST
142 if( fontSize == HUD_FONT_SMALL ) {
143 textString( scrn_rect.left + posincr, scrn_rect.top,
144 label_buffer, GLUT_BITMAP_8_BY_13, get_digits()); //suma
147 if( fontSize == HUD_FONT_LARGE ) {
148 textString( scrn_rect.left + posincr, scrn_rect.top,
149 label_buffer, GLUT_BITMAP_9_BY_15, get_digits()); //suma