gfx.c
changeset 4314 c7ded7546e7f
parent 4300 687a17c9c557
child 4344 5d0e40cd67b9
equal deleted inserted replaced
4313:bbd84f6e21b0 4314:c7ded7546e7f
   350 	TruncateStringID(str, buffer, maxw);
   350 	TruncateStringID(str, buffer, maxw);
   351 	return DoDrawString(buffer, x, y, color);
   351 	return DoDrawString(buffer, x, y, color);
   352 }
   352 }
   353 
   353 
   354 
   354 
   355 void DrawStringRightAligned(int x, int y, StringID str, uint16 color)
   355 int DrawStringRightAligned(int x, int y, StringID str, uint16 color)
   356 {
   356 {
   357 	char buffer[512];
   357 	char buffer[512];
       
   358 	int w;
   358 
   359 
   359 	GetString(buffer, str);
   360 	GetString(buffer, str);
   360 	DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
   361 	w = GetStringWidth(buffer);
       
   362 	DoDrawString(buffer, x - w, y, color);
       
   363 
       
   364 	return w;
   361 }
   365 }
   362 
   366 
   363 void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw)
   367 void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw)
   364 {
   368 {
   365 	char buffer[512];
   369 	char buffer[512];
   366 
   370 
   367 	TruncateStringID(str, buffer, maxw);
   371 	TruncateStringID(str, buffer, maxw);
   368 	DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
   372 	DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
       
   373 }
       
   374 
       
   375 void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color)
       
   376 {
       
   377 	int w = DrawStringRightAligned(x, y, str, color);
       
   378 	GfxFillRect(x - w, y + 10, x, y + 10, _string_colorremap[1]);
   369 }
   379 }
   370 
   380 
   371 
   381 
   372 int DrawStringCentered(int x, int y, StringID str, uint16 color)
   382 int DrawStringCentered(int x, int y, StringID str, uint16 color)
   373 {
   383 {