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

Location:
code/branches/HUD_HS16/src/modules/pickup
Files:
2 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
  • code/branches/HUD_HS16/src/modules/pickup/PickupManager.h

    r11252 r11253  
    135135
    136136            void dropPickup(uint32_t pickup); //!< Drop the input Pickupable.
    137             //void useUnusePickup(uint32_t index);
    138             void useUnusePickup(); //tolua_export
     137            static void useUnusePickup(uint32_t index); //tolua_export
    139138            void usePickup(uint32_t pickup, bool use); //!< Use (or unuse) the input Pickupable.
    140139             /**
Note: See TracChangeset for help on using the changeset viewer.