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
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/HUD_HS16/data/defaultConfig/keybindings.ini

    r11252 r11253  
    7070KeyNoConvert=
    7171KeyNumLock=
    72 KeyNumRow0="useUnusePickup"
    73 KeyNumRow1=
    74 KeyNumRow2=
    75 KeyNumRow3=
    76 KeyNumRow4=
    77 KeyNumRow5=
    78 KeyNumRow6=
    79 KeyNumRow7=
    80 KeyNumRow8=
    81 KeyNumRow9=
    82 KeyNumpad0="useUnusePickup"
    83 KeyNumpad1=
    84 KeyNumpad2=
    85 KeyNumpad3=
    86 KeyNumpad4=
    87 KeyNumpad5=
    88 KeyNumpad6=
    89 KeyNumpad7=
    90 KeyNumpad8=
    91 KeyNumpad9=
     72KeyNumRow0="useUnusePickup 0"
     73KeyNumRow1="useUnusePickup 1"
     74KeyNumRow2="useUnusePickup 2"
     75KeyNumRow3="useUnusePickup 3"
     76KeyNumRow4="useUnusePickup 4"
     77KeyNumRow5="useUnusePickup 5"
     78KeyNumRow6="useUnusePickup 6"
     79KeyNumRow7="useUnusePickup 7"
     80KeyNumRow8="useUnusePickup 8"
     81KeyNumRow9="useUnusePickup 9"
     82KeyNumpad0="useUnusePickup 0"
     83KeyNumpad1="useUnusePickup 1"
     84KeyNumpad2="useUnusePickup 2"
     85KeyNumpad3="useUnusePickup 3"
     86KeyNumpad4="useUnusePickup 4"
     87KeyNumpad5="useUnusePickup 5"
     88KeyNumpad6="useUnusePickup 6"
     89KeyNumpad7="useUnusePickup 7"
     90KeyNumpad8="useUnusePickup 8"
     91KeyNumpad9="useUnusePickup 9"
    9292KeyNumpadAdd=
    9393KeyNumpadComma=
  • 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.