Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 31, 2016, 2:07:50 PM (8 years ago)
Author:
patricwi
Message:

core system of keybindings fully functional, graphics still have to be implemented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc

    r11252 r11253  
    6767    RegisterAbstractClass(PickupManager).inheritsFrom<PickupListener>();
    6868
    69     SetConsoleCommand2("useUnusePickup", &PickupManager::useUnusePickup).addShortcut().setActive(true);
     69    SetConsoleCommand("useUnusePickup", &PickupManager::useUnusePickup).addShortcut().setActive(true);
    7070
    7171   // SetConsoleCommand("HumanController", "fire",           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
     
    378378    //This function is called by the command line or by the key binding
    379379    //it uses or unuses the pickup, depending on its current state
    380     void PickupManager::useUnusePickup() //uint32_t index
    381     {
    382         // orxout() << "Hello there i was here " << index << endl; 
    383         orxout() << "Hello there i was here " << endl;
    384         // Pickupable* pickup=pickups_.find(index)->second;
    385         // if(pickup==nullptr) return;                       //pickup does not exist
    386      
    387         // if(pickup->used)
    388         //     usePickup(pickup, false);
    389         // else
    390         //     usePickup(pickup, true);
     380    void PickupManager::useUnusePickup(uint32_t index) //uint32_t index
     381    {
     382        orxout() << "Hello there I was here " << index << endl;
     383
     384        PickupManager& manager = PickupManager::getInstance();
     385
     386        Pickupable* pickup=manager.pickups_.find(index)->second;
     387        if(pickup==nullptr)
     388        {
     389            orxout() << "The pickup does not exist." << endl;
     390            return;                       //pickup does not exist
     391        }
     392
     393        orxout() << "The pickup is being used: " << pickup->isUsed() << endl;
     394
     395        if(pickup->isUsed())
     396            manager.usePickup(index, false);
     397        else
     398            manager.usePickup(index, true);
    391399    }
    392400
Note: See TracChangeset for help on using the changeset viewer.