STARK: Show the mouse hint for inventory items

Not an accurate implementation, but good enough for now.
This commit is contained in:
Bastien Bouclet 2016-04-16 08:53:31 +02:00
parent 3150543c9a
commit eb173b63af
3 changed files with 12 additions and 0 deletions

View File

@ -162,6 +162,10 @@ void GameInterface::itemDoActionAt(Resources::ItemVisual *item, uint32 action, c
item->doAction(action, hotspotIndex);
}
Common::String GameInterface::getItemTitle(Resources::ItemVisual *item) {
return item->getHotspotTitle(0);
}
Common::String GameInterface::getItemTitleAt(Resources::ItemVisual *item, const Common::Point &pos) {
int32 hotspotIndex = item->getHotspotIndexForPoint(pos);
return item->getHotspotTitle(hotspotIndex);

View File

@ -65,6 +65,7 @@ public:
void itemDoActionAt(Resources::ItemVisual *item, uint32 action, const Common::Point &position);
/** Get the item's name */
Common::String getItemTitle(Resources::ItemVisual *object);
Common::String getItemTitleAt(Resources::ItemVisual *object, const Common::Point &pos);
/** List the actions available for an item in the current game state */

View File

@ -179,6 +179,13 @@ void InventoryWindow::onMouseMove(const Common::Point &pos) {
_cursor->setCursorImage(cursorImage);
_cursor->setFading(hoveredItemAction == _selectedInventoryItem);
}
if (hoveredItem) {
Common::String hint = StarkGameInterface->getItemTitle(hoveredItem);
_cursor->setMouseHint(hint);
} else {
_cursor->setMouseHint("");
}
}
void InventoryWindow::onClick(const Common::Point &pos) {