예제 #1
0
void TouchButton::draw(DrawBuffer &db, uint32_t color, uint32_t colorOverlay)
{
	float scale = 1.0f;
	if (isDown_) {
		color |= 0xFF000000;
		colorOverlay |= 0xFF000000;
		scale = 2.0f;
	}
	scale *= scale_;
	// We only mirror background
	db.DrawImageRotated(imageIndex_, x_ + w_*scale_/2, y_ + h_*scale_/2, scale, rotationAngle_, color, mirror_h_);
	if (overlayImageIndex_ != -1)
		db.DrawImageRotated(overlayImageIndex_, x_ + w_*scale_/2, y_ + h_*scale_/2, scale, rotationAngle_, colorOverlay);
}
예제 #2
0
void TouchCrossPad::draw(DrawBuffer &db, uint32_t color, uint32_t colorOverlay)
{
	static const float xoff[4] = {1, 0, -1, 0};
	static const float yoff[4] = {0, 1, 0, -1};
	static const int dir[4] = {PAD_BUTTON_RIGHT, PAD_BUTTON_DOWN, PAD_BUTTON_LEFT, PAD_BUTTON_UP};
	for (int i = 0; i < 4; i++) {
		float x = x_ + xoff[i] * scale_ * radius_;
		float y = y_ + yoff[i] * scale_ * radius_;
		float angle = i * M_PI / 2;
		float imgScale = (down_ & dir[i]) ? scale_ * 2 : scale_;
		db.DrawImageRotated(arrowIndex_, x, y, imgScale, angle + PI, color, false);
		if (overlayIndex_ != -1)
			db.DrawImageRotated(overlayIndex_, x, y, imgScale, angle + PI, colorOverlay);
	}
}