コード例 #1
0
void
DrawBattleCrewAmount (SHIP_INFO *ShipInfoPtr, COORD y_offs)
{
#define MAX_CREW_DIGITS 3
	RECT r;
	TEXT t;
	UNICODE buf[40];

	t.baseline.x = BATTLE_CREW_X + RES_STAT_SCALE(2) - RES_CASE(0,0,2); // JMS_GFX
	if (optWhichMenu == OPT_PC)
			t.baseline.x -= RES_STAT_SCALE(8); // JMS_GFX
	t.baseline.y = BATTLE_CREW_Y + y_offs;
	t.align = ALIGN_LEFT;
	t.pStr = buf;
	t.CharCount = (COUNT)~0;

	r.corner.x = t.baseline.x;
	r.corner.y = t.baseline.y - (5 << RESOLUTION_FACTOR); // JMS_GFX
	r.extent.width = 6 * MAX_CREW_DIGITS + (6 << RESOLUTION_FACTOR) + RESOLUTION_FACTOR; // JMS_GFX
	r.extent.height = (5 << RESOLUTION_FACTOR) + RES_CASE(0,2,3); // JMS_GFX

	sprintf (buf, "%u", ShipInfoPtr->crew_level);
	SetContextFont (StarConFont);

	SetContextForeGroundColor (
			BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08));
	DrawFilledRectangle (&r);
	SetContextForeGroundColor (BLACK_COLOR);
	font_DrawText (&t);
}
コード例 #2
0
ファイル: devices.c プロジェクト: smaass/UQM-MegaMod
static void
EraseDevicesBackground (void)
{
	RECT r;

	r.corner.x = RES_STAT_SCALE(2 + 1); // JMS_GFX
	r.extent.width = FIELD_WIDTH - RES_STAT_SCALE(1); // JMS_GFX
	r.corner.y = DEVICE_ORG_Y;
	r.extent.height = MAX_VIS_DEVICES * DEVICE_SPACING_Y;
	SetContextForeGroundColor (DEVICES_BACK_COLOR);
	DrawFilledRectangle (&r);
}
コード例 #3
0
ファイル: loadmele.c プロジェクト: Serosis/UQM-MegaMod
// Auxiliary function for DrawFileStrings
// If drawShips is set the ships themselves are drawn, in addition to the
// fleet name and value; if not, only the fleet name and value are drawn.
// If highlite is set the text is drawn in the color used for highlighting.
static void
DrawFileString (const MeleeTeam *team, const POINT *origin,
		BOOLEAN drawShips, BOOLEAN highlite)
{
	SetContextForeGroundColor (highlite ?
			LOAD_TEAM_NAME_TEXT_COLOR_HILITE : LOAD_TEAM_NAME_TEXT_COLOR);

	// Print the name of the fleet
	{
		TEXT Text;

		Text.baseline = *origin;
		Text.align = ALIGN_LEFT;
		Text.pStr = MeleeTeam_getTeamName(team);
		Text.CharCount = (COUNT)~0;
		font_DrawText (&Text);
	}

	// Print the value of the fleet
	{
		TEXT Text;
		UNICODE buf[60];

		sprintf (buf, "%u", MeleeTeam_getValue (team));
		Text.baseline = *origin;
		Text.baseline.x += NUM_MELEE_COLUMNS *
				(LOAD_MELEE_BOX_WIDTH + LOAD_MELEE_BOX_SPACE) - 1;
		Text.align = ALIGN_RIGHT;
		Text.pStr = buf;
		Text.CharCount = (COUNT)~0;
		font_DrawText (&Text);
	}

	// Draw the ships for the fleet
	if (drawShips)
	{
		STAMP s;
		FleetShipIndex slotI;

		s.origin.x = origin->x + RES_SCALE(1); // JMS_GFX
		s.origin.y = origin->y + RES_STAT_SCALE(4); // JMS_GFX
		for (slotI = 0; slotI < MELEE_FLEET_SIZE; slotI++)
		{
			BYTE StarShip;
				
			StarShip = team->ships[slotI];
			if (StarShip != MELEE_NONE)
			{
				s.frame = GetShipIconsFromIndex (StarShip);
				DrawStamp (&s);
				s.origin.x += RES_SCALE(17); // JMS_GFX
			}
		}
	}
}
コード例 #4
0
ファイル: gameopt.c プロジェクト: jurchik/project6014
static BOOLEAN
DrawNameString (bool nameCaptain, UNICODE *Str, COUNT CursorPos,
		COUNT state)
{
	RECT r;
	TEXT lf;
	Color BackGround, ForeGround;
	FONT Font;

	LockMutex (GraphicsLock);

	{
		r.extent.width = SHIP_NAME_WIDTH; // JMS_GFX
		r.extent.height = SHIP_NAME_HEIGHT;

		SetContext (StatusContext);
		if (nameCaptain)
		{	// Naming the captain
			Font = TinyFont;
			r.corner.x = RES_STAT_SCALE(3); // JMS_GFX;
			r.corner.y = RES_CASE(10,18,30); // JMS_GFX
			r.extent.width -= RES_STAT_SCALE(2); // JMS_GFX;
			lf.baseline.x = (STATUS_WIDTH >> 1) - RES_CASE(1,0,-1);
			lf.baseline.y = r.corner.y + r.extent.height - RES_CASE(1,4,3);

			BackGround = BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x1F), 0x09);
			ForeGround = BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x0B);
		}
		else
		{	// Naming the flagship
			Font = StarConFont;
			r.corner.x = RES_CASE(2,4,7); // JMS_GFX;
			r.corner.y = RES_CASE(20,40,62); // JMS_GFX;
			lf.baseline.x = r.corner.x + (r.extent.width >> 1);
			lf.baseline.y = r.corner.y + r.extent.height - RES_CASE(1,3,3); // JMS_GFX

			BackGround = BUILD_COLOR (MAKE_RGB15 (0x0F, 0x00, 0x00), 0x2D);
			ForeGround = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x0A, 0x00), 0x7D);
		}		

		lf.align = ALIGN_CENTER;
	}
コード例 #5
0
ファイル: shipstat.c プロジェクト: jurchik/project6014
void
DrawCrewFuelString (COORD y, SIZE state)
{
	STAMP Stamp;

	Stamp.origin.y = y + GAUGE_YOFFS + STARCON_TEXT_HEIGHT - RES_CASE(0,6,12);//(RESOLUTION_FACTOR == 2 ? 12 : 0);
	if (state == 0)
	{
		Stamp.origin.x = CREW_XOFFS + (STAT_WIDTH >> 1) + RES_STAT_SCALE(6) - RES_CASE(0,8,8);//(RESOLUTION_FACTOR == 2 ? 8 : 0); // JMS_GFX
		if (optWhichMenu == OPT_PC)
			Stamp.frame = SetAbsFrameIndex (StatusFrame, 4);
		else
			Stamp.frame = SetAbsFrameIndex (StatusFrame, 0);
		DrawStamp (&Stamp);
	}
コード例 #6
0
void
DrawCaptainsWindow (STARSHIP *StarShipPtr)
{
	COORD y;
	COORD y_offs;
	RECT r;
	STAMP s;
	FRAME Frame;
	RACE_DESC *RDPtr;

	RDPtr = StarShipPtr->RaceDescPtr;
	Frame = RDPtr->ship_data.captain_control.background;
	if (Frame)
	{
		Frame = SetAbsFrameIndex (Frame, 0);
		RDPtr->ship_data.captain_control.background = Frame;
		Frame = SetRelFrameIndex (Frame, 1);
		RDPtr->ship_data.captain_control.turn = Frame;
		Frame = SetRelFrameIndex (Frame, 5);
		RDPtr->ship_data.captain_control.thrust = Frame;
		Frame = SetRelFrameIndex (Frame, 3);
		RDPtr->ship_data.captain_control.weapon = Frame;
		Frame = SetRelFrameIndex (Frame, 3);
		RDPtr->ship_data.captain_control.special = Frame;
	}

	BatchGraphics ();
	
	// Grey area under and around captain's window.
	assert (StarShipPtr->playerNr >= 0);
	y_offs = status_y_offsets[StarShipPtr->playerNr];
	r.corner.x = CAPTAIN_XOFFS - RES_STAT_SCALE(4); // JMS_GFX
	r.corner.y = y_offs + SHIP_INFO_HEIGHT;
	r.extent.width = STATUS_WIDTH - 2;
	r.extent.height = SHIP_STATUS_HEIGHT - CAPTAIN_YOFFS + (4 << RESOLUTION_FACTOR); // JMS_GFX
	SetContextForeGroundColor (
			BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08));
	DrawFilledRectangle (&r);

	// Left border of the status panel.
	SetContextForeGroundColor (
			BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F));
	r.corner.x = 1;
	r.corner.y = y_offs + SHIP_INFO_HEIGHT;
	r.extent.width = 1;
	r.extent.height = (SHIP_STATUS_HEIGHT - SHIP_INFO_HEIGHT - 2);
	DrawFilledRectangle (&r);
	r.corner.x = 0;
	++r.extent.height;
	DrawFilledRectangle (&r);

	// Lower and right border of the status panel.
	SetContextForeGroundColor (
			BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19));
	r.corner.x = STATUS_WIDTH - 1;
	r.corner.y = y_offs + SHIP_INFO_HEIGHT;
	r.extent.width = 1;
	r.extent.height = SHIP_STATUS_HEIGHT - SHIP_INFO_HEIGHT;
	DrawFilledRectangle (&r);
	r.corner.x = STATUS_WIDTH - 2;
	DrawFilledRectangle (&r);
	r.corner.x = 1;
	r.extent.width = STATUS_WIDTH - 2;
	r.corner.y = y_offs + (SHIP_STATUS_HEIGHT - 2);
	r.extent.height = 1;
	DrawFilledRectangle (&r);
	r.corner.x = 0;
	++r.extent.width;
	++r.corner.y;
	DrawFilledRectangle (&r);
	
	y = y_offs + CAPTAIN_YOFFS;

	// Darker grey rectangle at bottom and right of captain's window
	SetContextForeGroundColor (
			BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F));
	r.corner.x = CAPTAIN_WIDTH + CAPTAIN_XOFFS;
	r.corner.y = y;
	r.extent.width = 1;
	r.extent.height = CAPTAIN_HEIGHT;
	DrawFilledRectangle (&r);
	r.corner.x = CAPTAIN_XOFFS - 1;
	r.corner.y += CAPTAIN_HEIGHT;
	r.extent.width = CAPTAIN_WIDTH + 2;
	r.extent.height = 1;
	DrawFilledRectangle (&r);

	// Light grey rectangle at top and left of captains window
	SetContextForeGroundColor (
			BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19));
	r.corner.x = CAPTAIN_XOFFS - 1;
	r.extent.width = CAPTAIN_WIDTH + 2;
	r.corner.y = y - 1;
	r.extent.height = 1;
	DrawFilledRectangle (&r);
	r.corner.x = CAPTAIN_XOFFS - 1;
	r.extent.width = 1;
	r.corner.y = y;
	r.extent.height = CAPTAIN_HEIGHT;
	DrawFilledRectangle (&r);

	s.frame = RDPtr->ship_data.captain_control.background;
	s.origin.x = CAPTAIN_XOFFS;
	s.origin.y = y;
	DrawStamp (&s);

	if (StarShipPtr->captains_name_index == 0
			&& StarShipPtr->playerNr == RPG_PLAYER_NUM)
	{	// This is SIS
		TEXT t;

		t.baseline.x = STATUS_WIDTH >> 1;
		t.baseline.y = y + RES_CASE(6,-22,-44); // JMS_GFX
		t.align = ALIGN_CENTER;
		t.pStr = GLOBAL_SIS (CommanderName);
		t.CharCount = (COUNT)~0;
		SetContextForeGroundColor (RES_CASE(BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x00), 0x02), BLACK_COLOR, BLACK_COLOR));
		SetContextFont (TinyFont);
		font_DrawText (&t);
	}
コード例 #7
0
ファイル: devices.c プロジェクト: smaass/UQM-MegaMod
static void
DrawDevicesDisplay (DEVICES_STATE *devState)
{
	TEXT t;
	RECT r;
	STAMP s;
	COORD cy;
	COUNT i;

	r.corner.x = RES_CASE(2,2,3); // JMS_GFX
	r.corner.y = RES_STAT_SCALE(20) - RES_CASE(0,1,0); // JMS_GFX
	r.extent.width = FIELD_WIDTH + 1; // JMS_GFX
	// XXX: Shouldn't the height be 1 less? This draws the bottom border
	//   1 pixel too low. Or if not, why do we need another box anyway?
	r.extent.height = RES_STAT_SCALE(129) - r.corner.y + RES_CASE(0,6,19); // JMS_GFX
	DrawStarConBox (&r, 1,
			SHADOWBOX_MEDIUM_COLOR, SHADOWBOX_DARK_COLOR,
			TRUE, DEVICES_BACK_COLOR);

	DrawBorder(12);

	// print the "DEVICES" title
	SetContextFont (StarConFont);
	t.baseline.x = (STATUS_WIDTH >> 1) - RES_STAT_SCALE(1); // JMS_GFX
	t.baseline.y = r.corner.y + RES_STAT_SCALE(7); // JMS_GFX
	t.align = ALIGN_CENTER;
	t.pStr = GAME_STRING (DEVICE_STRING_BASE);
	t.CharCount = (COUNT)~0;
	SetContextForeGroundColor (DEVICES_SELECTED_NAME_COLOR);
	font_DrawText (&t);

	s.origin.x = DEVICE_COL_0;
	cy = DEVICE_ORG_Y;

	// draw device icons and print names
	for (i = 0; i < MAX_VIS_DEVICES; ++i, cy += DEVICE_SPACING_Y)
	{
		COUNT devIndex = devState->topIndex + i;

		if (devIndex >= devState->count)
			break;

		// draw device icon
		s.origin.y = cy + ICON_OFS_Y;
		s.frame = SetAbsFrameIndex (MiscDataFrame,
				77 + devState->list[devIndex]);
		
		if (RESOLUTION_FACTOR < 2) {
			DrawStamp (&s);			
		} else {
			int oldMode, oldScale;
			oldMode = SetGraphicScaleMode (TFB_SCALE_BILINEAR);
			oldScale = SetGraphicScale ((int)(GSCALE_IDENTITY / 2));
			DrawStamp (&s);
			SetGraphicScale (oldScale);
			SetGraphicScaleMode (oldMode);
		}

		DrawDevice (devState->list[devIndex], i, false);
	}
}