More updates for font colors
This commit is contained in:
parent
abd090e0c2
commit
6fa817196a
2 changed files with 37 additions and 18 deletions
src
|
@ -862,28 +862,38 @@ local void DebugDrawFonts(void)
|
|||
|
||||
VideoFillRectangle(ColorWhite,0,0,40,VideoHeight-1);
|
||||
VideoDrawTextClip(8, 0+ 10,SmallFont,"FreeCraft");
|
||||
// VideoDrawTextClip(8, 0+ 20,SmallFont,
|
||||
// "~00~11~22~33~44~55~66~77~88~99~aa~bb~cc~dd~ee~ff");
|
||||
VideoDrawTextClip(8, 0+ 20,SmallFont,
|
||||
"~black~0~red~1~green~2~yellow~3~blue~4~magenta~5~cyan~6~white~7"
|
||||
"~grey~8~light-red~9~light-green~A~light-yellow~B~light-blue~C"
|
||||
"~light-magenta~D~light-cyan~E~light-grey~F");
|
||||
VideoDrawTextClip(8, 0+ 30,SmallFont,"abdefgABCDEFQ");
|
||||
|
||||
VideoDrawTextClip(8, 40+ 10,GameFont,"FreeCraft");
|
||||
// VideoDrawTextClip(8, 40+ 25,GameFont,
|
||||
// "~00~11~22~33~44~55~66~77~88~99~aa~bb~cc~dd~ee~ff");
|
||||
VideoDrawTextClip(8, 40+ 25,GameFont,
|
||||
"~black~0~red~1~green~2~yellow~3~blue~4~magenta~5~cyan~6~white~7"
|
||||
"~grey~8~light-red~9~light-green~A~light-yellow~B~light-blue~C"
|
||||
"~light-magenta~D~light-cyan~E~light-grey~F");
|
||||
VideoDrawTextClip(8, 40+ 40,GameFont,"abdefgABCDEFQ");
|
||||
|
||||
VideoDrawTextClip(8, 100+ 10,LargeFont,"FreeCraft");
|
||||
// VideoDrawTextClip(8, 100+ 25,LargeFont,
|
||||
// "~00~11~22~33~44~55~66~77~88~99~aa~bb~cc~dd~ee~ff");
|
||||
VideoDrawTextClip(8, 100+ 25,LargeFont,
|
||||
"~black~0~red~1~green~2~yellow~3~blue~4~magenta~5~cyan~6~white~7"
|
||||
"~grey~8~light-red~9~light-green~A~light-yellow~B~light-blue~C"
|
||||
"~light-magenta~D~light-cyan~E~light-grey~F");
|
||||
VideoDrawTextClip(8, 100+ 40,LargeFont,"abdefgABCDEFQ");
|
||||
|
||||
VideoDrawTextClip(8, 160+ 10,SmallTitleFont,"FreeCraft");
|
||||
// VideoDrawTextClip(8, 160+ 35,SmallTitleFont,
|
||||
// "~00~11~22~33~44~55~66~77~88~99~aa~bb~cc~dd~ee~ff");
|
||||
VideoDrawTextClip(8, 160+ 35,SmallTitleFont,
|
||||
"~black~0~red~1~green~2~yellow~3~blue~4~magenta~5~cyan~6~white~7"
|
||||
"~grey~8~light-red~9~light-green~A~light-yellow~B~light-blue~C"
|
||||
"~light-magenta~D~light-cyan~E~light-grey~F");
|
||||
VideoDrawTextClip(8, 160+ 60,SmallTitleFont,"abdefgABCDEFQ");
|
||||
|
||||
VideoDrawTextClip(8, 260+ 10,LargeTitleFont,"FreeCraft");
|
||||
// VideoDrawTextClip(8, 260+ 55,LargeTitleFont,
|
||||
// "~00~11~22~33~44~55~66~77~88~99~aa~bb~cc~dd~ee~ff");
|
||||
VideoDrawTextClip(8, 260+ 55,LargeTitleFont,
|
||||
"~black~0~red~1~green~2~yellow~3~blue~4~magenta~5~cyan~6~white~7"
|
||||
"~grey~8~light-red~9~light-green~A~light-yellow~B~light-blue~C"
|
||||
"~light-magenta~D~light-cyan~E~light-grey~F");
|
||||
VideoDrawTextClip(8, 260+ 100,LargeTitleFont,"abdefgABCDEFQ");
|
||||
|
||||
PopClipping();
|
||||
|
|
|
@ -483,6 +483,8 @@ local int DoDrawText(int x,int y,unsigned font,const unsigned char* text,
|
|||
int widths;
|
||||
const ColorFont* fp;
|
||||
const VMemType* rev;
|
||||
char* color;
|
||||
const char* p;
|
||||
void (*DrawChar)(const Graphic*,int,int,int,int,int,int);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
|
@ -505,13 +507,6 @@ local int DoDrawText(int x,int y,unsigned font,const unsigned char* text,
|
|||
return widths;
|
||||
case '~':
|
||||
break;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
fprintf(stderr,"Not supported: ~%c\n",*text);
|
||||
ExitFatal(1);
|
||||
break;
|
||||
case '!':
|
||||
rev=FontPixels;
|
||||
FontPixels=ReverseTextColor;
|
||||
|
@ -528,7 +523,21 @@ local int DoDrawText(int x,int y,unsigned font,const unsigned char* text,
|
|||
continue;
|
||||
|
||||
default:
|
||||
DebugLevel0Fn("oops, format your ~\n");
|
||||
p=text;
|
||||
while( *p && *p!='~' ) {
|
||||
++p;
|
||||
}
|
||||
if( !*p ) {
|
||||
DebugLevel0Fn("oops, format your ~\n");
|
||||
return widths;
|
||||
}
|
||||
color=malloc(p-text+1);
|
||||
memcpy(color,text,p-text);
|
||||
color[p-text]='\0';
|
||||
text=p;
|
||||
LastTextColor=FontPixels;
|
||||
FontPixels=GetFontColorMapping(color);
|
||||
free(color);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue