T_void HardFormUpdateTest2(T_void) { static T_byte8 color = 0; DebugRoutine("HardFormUpdateTest"); GrDrawRectangle( 4, 3, 4+VIEW3D_CLIP_RIGHT-VIEW3D_CLIP_LEFT-1, 3+VIEW3D_HEIGHT-1, 48); GrDrawRectangle( 4, 4, 100, 10, color++); GrDrawRectangle( 5, 100, 37, 160, 10); GrSetCursorPosition(5, 101); GrDrawText("1", 31); GrDrawRectangle( 45, 100, 77, 160, 10); GrSetCursorPosition(45, 101); GrDrawText("75", 31); GrDrawRectangle( 85, 100, 117, 160, 10); GrSetCursorPosition(85, 101); GrDrawText("74", 31); GrDrawRectangle( 125, 100, 157, 160, 10); GrSetCursorPosition(125, 101); GrDrawText("32", 31); MessageDraw(4, 4, 10, COLOR_WHITE); ClientUpdateHealth(); BannerUpdate(); StatsUpdatePlayerStatistics(); EffectUpdateAllPlayerEffects(); DebugEnd(); }
T_void MessageDrawLine( T_word16 x_pos, T_word16 y_pos, T_byte8 *line, T_color color) { T_word16 j; T_word16 len; char c; T_byte8 val; len = strlen((char *)line); for (j = 0; j < len; j++) { c = line[j]; if (c == '^') { /* skip caret */ j++; /* get color value */ val = 0; val += ((line[j++] - '0') * 100); if (j < len) val += ((line[j++] - '0') * 10); if (j < len) val += ((line[j] - '0')); DebugCheck(val < MAX_EXTENDED_COLORS); if (val >= MAX_EXTENDED_COLORS) val = MAX_EXTENDED_COLORS - 1; /* change color */ color = G_extendedColors[val]; } else { GrSetCursorPosition(x_pos + 1, y_pos + 1); GrDrawCharacter(c, 0); GrSetCursorPosition(x_pos, y_pos); GrDrawCharacter(c, color); x_pos += GrGetCharacterWidth(c); } } }
/** * MessageDraw draws MAX_VIEWED_MESSAGES of message lines on the * currently active screen at given x and y coordinate. The amount of * space from line to line is also given by an interleave variable. * * NOTE: * It is assumed that the currently active screen is where the messages * need to be drawn. * * @param x -- Starting x to draw * @param y -- Starting y to draw * @param interleave -- How far down to next line * @param color -- Color of text * *<!-----------------------------------------------------------------------*/ T_void MessageDraw( T_word16 x, T_word16 y, T_word16 interleave, T_color color) { T_word16 i ; T_word16 current ; T_word16 y_pos; T_word16 x_pos; T_byte8 ncolor; T_resourceFile res; T_resource font; T_bitfont *p_font; DebugRoutine("MessageDraw") ; /* lock in font */ res = ResourceOpen ("sample.res"); font=ResourceFind (res,"FontTiny"); p_font=ResourceLock (font); GrSetBitFont (p_font); /* Loop through up to MAX_VIEWED_MESSAGES, but stop if we reach the */ /* end of the message list. Keep track of the current message and */ /* also the position on the screen. */ for (i=0, current=G_currentMessage, y_pos = y; (i<MAX_VIEWED_MESSAGES) && (current < G_numMessages); i++, current++, y_pos+=interleave) { /* draw each character, checking for embedded color controls */ x_pos=0; ncolor=G_extendedColors[7]; MessageDrawLine(x_pos, y_pos, P_Messages[current], ncolor); } #if 0 if (P_Messages[current][0]=='^') { /* special color imbedded in string */ val=0; val+=((P_Messages[current][1]-'0')*100); val+=((P_Messages[current][2]-'0')*10); val+=((P_Messages[current][3]-'0')); if (val < MAX_EXTENDED_COLORS) { ncolor = G_extendedColors[val]; } else DebugCheck (0); /* hide color code chars */ temp+=4; } GrSetCursorPosition(x, y_pos) ; GrDrawShadowedText(temp, ncolor, COLOR_BLACK) ; #endif /* unlock the font */ ResourceUnlock (font); ResourceClose (res); DebugEnd() ; }