select inventory 1-9
This commit is contained in:
parent
aa84fa0823
commit
103c43eba1
@ -259,14 +259,22 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
|||||||
|
|
||||||
case SDLK_1:
|
case SDLK_1:
|
||||||
case SDLK_2:
|
case SDLK_2:
|
||||||
{
|
case SDLK_3:
|
||||||
int hot_key = (event.key.keysym.sym == SDLK_1) ? 1 : 2;
|
case SDLK_4:
|
||||||
|
case SDLK_5:
|
||||||
|
case SDLK_6:
|
||||||
|
case SDLK_7:
|
||||||
|
case SDLK_8:
|
||||||
|
case SDLK_9:
|
||||||
|
{
|
||||||
|
|
||||||
UnselectAllItems();
|
UnselectAllItems();
|
||||||
if (InventoryItem* item = GetItemByHotkey(hot_key)) {
|
if (InventoryItem* item = GetItemByHotkey(event.key.keysym.sym - SDLK_1 + 1)) {
|
||||||
item->isSelected = true;
|
item->isSelected = true;
|
||||||
std:: cout << item->name << std::endl;
|
std:: cout << item->name << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
// ...handle other keys...
|
// ...handle other keys...
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user