Exemple #1
0
void HUD::updateTargetObject() {
	if (_targetObject) {
		Door *door = ObjectContainer::toDoor(_targetObject);
		if (door && !door->isUsable())
			_targetObject = nullptr;
	}

	if (!_targetObject) {
		_targetCircle->hide();
		hideTargetInformation();
		return;
	}

	_targetCircle->setHovered(_hoveredObject == _targetObject);

	float sX, sY;
	bool onScreen = _targetCircle->moveTo(_targetObject, sX, sY);
	if (onScreen) {
		_targetCircle->show();
		updateTargetInformation(_targetObject, sX, sY);
		showTargetInformation(_targetObject);
	} else {
		_targetCircle->hide();
		hideTargetInformation();
	}
}
Exemple #2
0
void HUD::updateHoveredObject() {
	if (_hoveredObject) {
		Door *door = ObjectContainer::toDoor(_hoveredObject);
		if (door && !door->isUsable())
			_hoveredObject = nullptr;
	}

	if (!_hoveredObject || (_hoveredObject == _targetObject)) {
		_hoveredCircle->hide();
		return;
	}

	float _, __;
	bool onScreen = _hoveredCircle->moveTo(_hoveredObject, _, __);

	if (onScreen)
		_hoveredCircle->show();
	else
		_hoveredCircle->hide();
}