void Window_Base::DrawGauge(Game_Battler* actor, int cx, int cy) {
	FileRequestAsync* request = AsyncHandler::RequestFile("System2", Data::system.system2_name);
	if (!request->IsReady()) {
		// Gauge refreshed each frame, so we can wait via polling
		request->Start();
		return;
	}

	BitmapRef system2 = Cache::System2(Data::system.system2_name);

	bool full = actor->IsGaugeFull();
	int gauge_w = actor->GetGauge() / 4;

	// Which gauge (0 - 2)
	int gauge_y = 32 + 2 * 16;

	// Three components of the gauge
	Rect gauge_left(0, gauge_y, 16, 16);
	Rect gauge_center(16, gauge_y, 16, 16);
	Rect gauge_right(32, gauge_y, 16, 16);

	// Full or not full bar
	Rect gauge_bar(full ? 64 : 48, gauge_y, 16, 16);

	Rect dst_rect(cx + 16, cy, 25, 16);
	Rect bar_rect(cx + 16, cy, gauge_w, 16);

	contents->Blit(cx + 0, cy, *system2, gauge_left, 255);
	contents->Blit(cx + 16 + 25, cy, *system2, gauge_right, 255);

	contents->StretchBlit(dst_rect, *system2, gauge_center, 255);
	contents->StretchBlit(bar_rect, *system2, gauge_bar, 255);
}
Exemple #2
0
void Window_BattleStatus::DrawGauge(Game_Actor* /* actor */, int index, int cx, int cy) {
	BitmapRef system2 = Cache::System2(Data::system.system2_name);

	Battle::Ally& ally = Game_Battle::GetAlly(index);
	bool full = ally.IsReady();
	int gauge_w = ally.gauge * 25 / Game_Battle::gauge_full;
	int speed = 2; // FIXME: how to determine?
	int gauge_y = 32 + speed * 16;
	Rect gauge_left(0, gauge_y, 16, 16);
	Rect gauge_center(16, gauge_y, 16, 16);
	Rect gauge_right(32, gauge_y, 16, 16);
	Rect gauge_bar(full ? 64 : 48, gauge_y, 16, 16);
	Rect dst_rect(cx+16, cy, 25, 16);
	Rect bar_rect(cx+16, cy, gauge_w, 16);

	contents->Blit(cx+0, cy, *system2, gauge_left, 255);
	contents->StretchBlit(dst_rect, *system2, gauge_center, 255);
	contents->Blit(cx+16+25, cy, *system2, gauge_right, 255);
	contents->StretchBlit(bar_rect, *system2, gauge_bar, 255);
}