Пример #1
0
void drawLoadingBitmap (float progress)
{
	if (!LoadingMaterial.empty() && !LoadingMaterialFull.empty())
	{
		Driver->setMatrixMode2D11();
		LoadingMaterialFull.setAlphaTestThreshold (1.f-progress);

		CQuadUV		quad;
		quad.V0.set (0,0,0);
		quad.V1.set (1,0,0);
		quad.V2.set (1,1,0);
		quad.V3.set (0,1,0);
		quad.Uv0.U= 0;
		quad.Uv0.V= 0.75f;
		quad.Uv1.U= 1;
		quad.Uv1.V= 0.75f;
		quad.Uv2.U= 1;
		quad.Uv2.V= 0;
		quad.Uv3.U= 0;
		quad.Uv3.V= 0;

		Driver->drawQuad(quad, LoadingMaterial);
		Driver->drawQuad(quad, LoadingMaterialFull);
	}
}
Пример #2
0
void drawLoadingBitmap (float progress)
{
	if (!LoadingMaterial.empty() && !LoadingMaterialFull.empty())
	{
		Driver->setMatrixMode2D11();
		LoadingMaterialFull.setAlphaTestThreshold (1.f-progress);

		CQuadUV		quad;
		uint wh =  Driver->getWindowHeight();
		uint ww = Driver->getWindowWidth();
		float x1 = 0;
		float y1 = 0;
		float x2 = 1;
		float y2 = 1;

		if ((ww > 1024) || (wh > 768))
		{
			if ((ww - 1024) > (wh - 768))
				x1 = ((ww - (wh * 1024.f) / 768.f) / 2.f) / ww;
			else
				y1 = ((wh - (ww * 768.f) / 1024.f) / 2.f) / wh;
		}

		if (x1 != 0)
			x2 = 1 - x1;
		if (y1 != 0)
			y2 = 1 - y1;

		quad.V0.set (x1,y1,0);
		quad.V1.set (x2,y1,0);
		quad.V2.set (x2,y2,0);
		quad.V3.set (x1,y2,0);

		quad.Uv0.U= 0;
		quad.Uv0.V= 0.75f;
		quad.Uv1.U= 1;
		quad.Uv1.V= 0.75f;
		quad.Uv2.U= 1;
		quad.Uv2.V= 0;
		quad.Uv3.U= 0;
		quad.Uv3.V= 0;

		Driver->drawQuad(0, 0, 1, 1, CRGBA(0, 0, 0, 255));
		Driver->drawQuad(quad, LoadingMaterial);
		Driver->drawQuad(quad, LoadingMaterialFull);
	}
}