Пример #1
0
/**
**	Draw reverse number with font at x,y unclipped.
**
**	@param x	X screen position
**	@param y	Y screen position
**	@param font	Font number
**	@param number	Number to be displayed.
**
**	@return		The length of the printed text.
*/
global int VideoDrawReverseNumber(int x,int y,unsigned font,int number)
{
    char buf[sizeof(int)*10+2];

    sprintf(buf,"%d",number);
    return VideoDrawReverseText(x,y,font,buf);
}
Пример #2
0
/**
**  Draw reverse number with font at x,y unclipped.
**
**  @param x       X screen position
**  @param y       Y screen position
**  @param font    Font number
**  @param number  Number to be displayed.
**
**  @return        The length of the printed text.
*/
int VideoDrawReverseNumber(int x, int y, CFont *font, int number)
{
	char buf[sizeof(int) * 10 + 2];

	FormatNumber(number, buf);
	return VideoDrawReverseText(x, y, font, buf);
}
Пример #3
0
/**
**  Draw the player resource in top line.
**
**  @todo FIXME : make DrawResources more configurable (format, font).
*/
void DrawResources(void)
{
	char tmp[128];
	int i;
	int v;

	// Draw all icons of resource.
	for (i = 0; i <= ScoreCost; ++i) {
		if (UI.Resources[i].G) {
			UI.Resources[i].G->DrawFrameClip(UI.Resources[i].IconFrame,
				UI.Resources[i].IconX, UI.Resources[i].IconY);
		}
	}
	for (i = 0; i < MaxCosts; ++i) {
		if (UI.Resources[i].TextX != -1) {
			v = ThisPlayer->Resources[i];
			VideoDrawNumber(UI.Resources[i].TextX,
				UI.Resources[i].TextY + (v > 99999) * 3,
				v > 99999 ? SmallFont : GameFont, v);
		}
	}
	if (UI.Resources[FoodCost].TextX != -1) {
		sprintf(tmp, "%d/%d", ThisPlayer->Demand, ThisPlayer->Supply);
		if (ThisPlayer->Supply < ThisPlayer->Demand) {
			VideoDrawReverseText(UI.Resources[FoodCost].TextX,
				UI.Resources[FoodCost].TextY, GameFont, tmp);
		} else {
			VideoDrawText(UI.Resources[FoodCost].TextX,
				UI.Resources[FoodCost].TextY, GameFont, tmp);
		}
	}
	if (UI.Resources[ScoreCost].TextX != -1) {
		v = ThisPlayer->Score;
		VideoDrawNumber(UI.Resources[ScoreCost].TextX,
			UI.Resources[ScoreCost].TextY + (v > 99999) * 3,
			v > 99999 ? SmallFont : GameFont, v);
	}
}