Esempio n. 1
0
SplashScreen::SplashScreen(Application* application) : Sprite(application)
{
	Dib dib1 = logo2dib(application, logo1, sizeof(logo1), 320, 44);
	Dib dib2 = logo2dib(application, logo2, sizeof(logo2), 320, 96);

	TextureParameters parameters;
	data1_ = application_->getTextureManager()->createTextureFromDib(dib1, parameters);
	data2_ = application_->getTextureManager()->createTextureFromDib(dib2, parameters);
	
	graphicsBase1_ = createGraphicsBase(data1_, 0, 0);
	graphicsBase2_ = createGraphicsBase(data2_, 0, 30);

	startTime_ = iclock();

	Orientation orientation = application->orientation();
	float width = application->getHardwareWidth();
	float height = application->getHardwareHeight();
	if (orientation == eLandscapeLeft || orientation == eLandscapeRight)
		std::swap(width, height);	
	float dx = (width - 320) / 2;
	float dy = (height - 140) / 2; 

	float sx = application->getLogicalScaleX();
	float sy = application->getLogicalScaleY();
	float tx = application->getLogicalTranslateX();
	float ty = application->getLogicalTranslateY();
	setScaleXY(1/sx, 1/sy);
	setXY((-tx + dx) / sx, (-ty + dy) / sy);
}
Esempio n. 2
0
static void createTexturePolygon(	TextureBase* texture, const Matrix& matrix,
									const std::vector<std::vector<Point2f> > & contours,
									bool evenodd,
									GraphicsBase& result)
{
    createGraphicsBase(contours, result, evenodd, true, texture->uvscalex / texture->data->exwidth, texture->uvscaley / texture->data->exheight, &matrix);
	result.data = texture->data;
}
Esempio n. 3
0
static void createSolidPolygon(	float r, float g, float b, float a,
								const std::vector<std::vector<Point2f> > & contours,
								bool evenodd,
								GraphicsBase& result)
{
	createGraphicsBase(contours, result, evenodd);
	result.setColor(r, g, b, a);
}
Esempio n. 4
0
static void createSolidLineStrip(float r, float g, float b, float a,
								   float thickness,
								   const std::vector<Point2f>& points,
									GraphicsBase& result)
{
	if (points.size() < 2)
		return;

	std::vector<std::vector<Point2f> > polygon(points.size() - 1);

	for (std::size_t i = 1; i < points.size(); ++i)
	{
		const Point2f& p0 = points[i - 1];
		const Point2f& p1 = points[i];

		lineToPolygon(p0.x, p0.y, p1.x, p1.y, thickness, polygon[i - 1]);
	}

	createGraphicsBase(polygon, result, false);
	result.setColor(r, g, b, a);
}