예제 #1
0
bool UI::onFingerRelease (int64_t finger, float x, float y)
{
	if (_restart)
		return false;

	const uint16_t _x = _frontend->getCoordinateOffsetX() + x * _frontend->getWidth();
	const uint16_t _y = _frontend->getCoordinateOffsetY() + y * _frontend->getHeight();
	UIStack stack = _stack;
	for (UIStackReverseIter i = stack.rbegin(); i != stack.rend(); ++i) {
		UIWindow* window = *i;
		const bool focus = window->checkFocus(_x, _y);
		if (focus && window->onFingerRelease(finger, _x, _y))
			return true;
		if (window->isModal() || window->isFullscreen())
			break;
	}
	return false;
}
예제 #2
0
void UI::onMouseMotion (int32_t x, int32_t y, int32_t relX, int32_t relY)
{
	if (_restart)
		return;

	GETSCALE_W(relX);
	GETSCALE_H(relY);
	_frontend->setCursorPosition(_cursorX + relX, _cursorY + relY);
	UIStack stack = _stack;
	for (UIStackReverseIter i = stack.rbegin(); i != stack.rend(); ++i) {
		UIWindow* window = *i;
		const bool focus = window->checkFocus(_cursorX, _cursorY);
		if (focus) {
			window->onMouseMotion(_cursorX, _cursorY, relX, relY);
			break;
		}
		if (window->isModal() || window->isFullscreen())
			break;
	}
}