select inventory 1-9

This commit is contained in:
maka70vv 2025-03-02 18:19:25 +06:00
parent aa84fa0823
commit 103c43eba1

View File

@ -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...
} }