Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11252


Ignore:
Timestamp:
Oct 31, 2016, 1:02:46 PM (8 years ago)
Author:
patricwi
Message:

setCommand vorbereitet und keybindings optimiert

Location:
code/branches/HUD_HS16
Files:
5 edited

Legend:

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

    r10622 r11252  
    7070KeyNoConvert=
    7171KeyNumLock=
    72 KeyNumRow0=
    73 KeyNumRow1="toggleFormationFlight"
    74 KeyNumRow2="FFChangeMode"
     72KeyNumRow0="useUnusePickup"
     73KeyNumRow1=
     74KeyNumRow2=
    7575KeyNumRow3=
    7676KeyNumRow4=
     
    8080KeyNumRow8=
    8181KeyNumRow9=
    82 KeyNumpad0=
     82KeyNumpad0="useUnusePickup"
    8383KeyNumpad1=
    8484KeyNumpad2=
     
    9696KeyNumpadPeriod=
    9797KeyNumpadSubtract=
    98 KeyO=
    99 KeyP=
     98KeyO="toggleFormationFlight"
     99KeyP="FFChangeMode"
    100100KeyPageDown="scale -1 rotateRoll"
    101101KeyPageUp=
  • code/branches/HUD_HS16/data/gui/scripts/KeyBindMenu.lua

    r8232 r11252  
    3636    table.insert(commandList, "pause")
    3737    table.insert(commandList, "printScreen")
     38    table.insert(commandList, "useUnusePickup")
    3839    if orxonox.GUIManager:inDevMode() then
    3940        table.insert(commandList, "printScreenHD")
     
    7172    table.insert(nameList, "Pause")
    7273    table.insert(nameList, "Screenshot")
     74    table.insert(nameList, "Pickup 0")
    7375    if orxonox.GUIManager:inDevMode() then
    7476        table.insert(nameList, "HD screenshot")
  • code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc

    r11241 r11252  
    4343#include "core/input/KeyBinderManager.h"    //for keybinding
    4444#include "core/input/KeyBinder.h"           //for keybinding
     45#include "core/command/ConsoleCommandIncludes.h"
    4546
    4647#include "infos/PlayerInfo.h"
     
    6667    RegisterAbstractClass(PickupManager).inheritsFrom<PickupListener>();
    6768
     69    SetConsoleCommand2("useUnusePickup", &PickupManager::useUnusePickup).addShortcut().setActive(true);
     70
     71   // SetConsoleCommand("HumanController", "fire",           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
    6872    /**
    6973    @brief
     
    290294            this->pickups_[index] = pickup;
    291295
    292             //Add pickup keybinding
    293             if( KeyBinderManager::exists() )
    294                 addKeyBindingForNewPickup(pickup, index);
    295             else
    296                 orxout() << "Could not create new keybinding because KeyBinderManager doesn't exist." << endl;
     296            // //Add pickup keybinding
     297            // if( KeyBinderManager::exists() )
     298            //     addKeyBindingForNewPickup(pickup, index);
     299            // else
     300            //     orxout() << "Could not create new keybinding because KeyBinderManager doesn't exist." << endl;
    297301        }
    298302        else // If it was dropped, it is removed from the required lists.
     
    302306            index = it->second;
    303307
    304             //Remove pickup keybinding
    305             if( KeyBinderManager::exists() )
    306                   removeKeyBindingForOldPickup(pickup, index);
    307             else
    308                 orxout() << "Could not delete old keybinding because KeyBinderManager doesn't exist." << endl;
     308            // //Remove pickup keybinding
     309            // if( KeyBinderManager::exists() )
     310            //       removeKeyBindingForOldPickup(pickup, index);
     311            // else
     312            //     orxout() << "Could not delete old keybinding because KeyBinderManager doesn't exist." << endl;
    309313
    310314            // Remove the Pickupable from the indexes_ and pickups_ list.
    311315            this->indexes_.erase(pickup);
    312             this->pickups_.find(index)->second=nullptr; //set to null, so that can be indentified as free slot by getPickupIndex()
     316            this->pickups_.find(index)->second=nullptr; //set to null, so that can be identified as free slot by getPickupIndex()
    313317        }
    314318
     
    339343
    340344    //PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9
    341     //FUNCTION: Adds a keybinding for the new pickup using its index
    342     void PickupManager::addKeyBindingForNewPickup(Pickupable* pickup, uint32_t index)
    343     {
    344         std::string name="Keys.KeyNumpad";
    345         std::string binding="";
    346 
    347         name.append(std::to_string(index));
    348 
    349         KeyBinderManager::getInstance().getCurrent()->setBinding("KeyESC", name, true); // TODO do not set all bindings to ESC
    350 
    351         orxout() << "Keybinding for item " << index << " has been added on keybinding " << name << endl;
    352 
    353 
    354     }
     345    //FUNCTION: Adds a keybinding for the new pickup using its index and sets a console command
     346    // void PickupManager::addKeyBindingForNewPickup(Pickupable* pickup, uint32_t index)
     347    // {
     348    //     std::string name="Keys.KeyNumpad";
     349    //     std::string binding="useOrUnusePickup";
     350
     351    //     name.append(std::to_string(index));
     352    //     binding.append(std::to_string(index));
     353
     354    //     SetConsoleCommand(binding, &PickupManager::useUnusePickup(pickup, index));
     355    //     KeyBinderManager::getInstance().getCurrent()->setBinding(binding, name, true);
     356
     357    //     orxout() << "Keybinding for item " << index << " has been added on keybinding " << name << endl;
     358
     359
     360    // }
    355361
    356362    //PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9
    357363    //FUNCTION: Removes the keybinding of the pickup using its index
    358     void PickupManager::removeKeyBindingForOldPickup(Pickupable* pickup, uint32_t index)
    359     {
    360         std::string name="Keys.KeyNumpad";
    361         std::string binding="";
    362 
    363         name.append(std::to_string(index));
    364 
    365         KeyBinderManager::getInstance().getCurrent()->setBinding("", name, true);
    366 
    367         orxout() << "Keybinding for item " << index << " has been removed on keybinding " << name << endl;
    368 
    369     }
     364    // void PickupManager::removeKeyBindingForOldPickup(Pickupable* pickup, uint32_t index)
     365    // {
     366    //     std::string name="Keys.KeyNumpad";
     367    //     std::string binding="";
     368
     369    //     name.append(std::to_string(index));
     370
     371    //     SetConsoleCommand(binding, nullptr);
     372    //     KeyBinderManager::getInstance().getCurrent()->setBinding("", name, true);
     373
     374    //     orxout() << "Keybinding for item " << index << " has been removed on keybinding " << name << endl;
     375
     376    // }
     377
     378    //This function is called by the command line or by the key binding
     379    //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);
     391    }
     392
    370393
    371394    /**
  • code/branches/HUD_HS16/src/modules/pickup/PickupManager.h

    r11241 r11252  
    135135
    136136            void dropPickup(uint32_t pickup); //!< Drop the input Pickupable.
     137            //void useUnusePickup(uint32_t index);
     138            void useUnusePickup(); //tolua_export
    137139            void usePickup(uint32_t pickup, bool use); //!< Use (or unuse) the input Pickupable.
    138140             /**
  • code/branches/HUD_HS16/src/orxonox/controllers/HumanController.h

    r11071 r11252  
    6969            void stopBoosting(void);
    7070
    71 
    7271            static void greet();
    7372            static void switchCamera();
Note: See TracChangeset for help on using the changeset viewer.