Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2010, 3:37:40 AM (14 years ago)
Author:
landauf
Message:

merged consolecommands3 branch back to trunk.

note: the console command interface has changed completely, but the documentation is not yet up to date. just copy an existing command and change it to your needs, it's pretty self-explanatory. also the include files related to console commands are now located in core/command/. in the game it should work exactly like before, except for some changes in the auto-completion.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/input/InputManager.cc

    r7266 r7284  
    4747#include "core/CoreIncludes.h"
    4848#include "core/ConfigValueIncludes.h"
    49 #include "core/ConsoleCommand.h"
    5049#include "core/CommandLineParser.h"
    51 #include "core/Functor.h"
    5250#include "core/GraphicsManager.h"
     51#include "core/command/ConsoleCommand.h"
     52#include "core/command/Functor.h"
    5353
    5454#include "InputBuffer.h"
     
    6161{
    6262    SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
     63
     64    static const std::string __CC_InputManager_name = "InputManager";
     65    static const std::string __CC_calibrate_name = "calibrate";
     66    static const std::string __CC_reload_name = "reload";
     67
     68    SetConsoleCommand(__CC_InputManager_name, __CC_calibrate_name, &InputManager::calibrate).addShortcut();
     69    SetConsoleCommand(__CC_InputManager_name, __CC_reload_name,    &InputManager::reload   );
    6370
    6471    // Abuse of this source file for the InputHandler
     
    118125        this->updateActiveStates();
    119126
    120         // calibrate console command
    121         this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::calibrate, this), "calibrate"), true);
    122         // reload console command
    123         this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::reload, this), "reload"), false);
     127        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(this);
     128        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(this);
    124129
    125130        CCOUT(4) << "Construction complete." << std::endl;
     
    287292        if (!(internalState_ & Bad))
    288293            this->destroyDevices();
     294
     295        // Reset console commands
     296        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0);
     297        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
    289298
    290299        CCOUT(3) << "Destruction complete." << std::endl;
Note: See TracChangeset for help on using the changeset viewer.