Beispiel #1
0
bool Slider::isWithinBounds(Vec2d &point)
{
	point.setY(game->getDisplay()->getDimensions().Y() - point.Y());

	Vec2d pos = mPosition + mMenuPosition;

	pos.addX(mSliderPosition);

	return (point.X() >= pos.X() &&
			point.Y() >= pos.Y() &&
			point.X() <= pos.X() + 32 &&
			point.Y() <= pos.Y() + 32
			);
}
Beispiel #2
0
Vec2d Font::getStringDimensionsVec2d(std::string &msg)
{
	Vec2d out;

	if(msg.length() > 0)
		out.addY(getHeight());

	for(size_t i = 0; i < msg.length(); ++i)
	{
		char c = msg[i];

		if(c == '\n' || c == '\r')
		{
			out.addY(getHeight());
			continue;
		}

		out.addX((*mpFontMetrics)[c % MAX_ALPHABET].mSize.X());
	}

	return out;
}