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/Mouse.cc

    r5929 r7284  
    3030
    3131#include <ois/OISMouse.h>
    32 #include "core/ConsoleCommand.h"
    3332#include "core/CoreIncludes.h"
     33#include "core/command/ConsoleCommand.h"
    3434#include "InputState.h"
    3535
     
    4141namespace orxonox
    4242{
     43#ifdef ORXONOX_PLATFORM_LINUX
     44    static const std::string __CC_Mouse_name = "Mouse";
     45    static const std::string __CC_grab_name = "grab";
     46    static const std::string __CC_ungrab_name = "ungrab";
     47
     48    SetConsoleCommand(__CC_Mouse_name, __CC_grab_name,   &Mouse::grab);
     49    SetConsoleCommand(__CC_Mouse_name, __CC_ungrab_name, &Mouse::ungrab);
     50#endif
     51
    4352    Mouse::Mouse(unsigned int id, OIS::InputManager* oisInputManager)
    4453        : super(id, oisInputManager)
     
    4857
    4958#ifdef ORXONOX_PLATFORM_LINUX
    50         // Mouse grab console command
    51         this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&Mouse::grab, this), "grab"), false);
    52         // Mouse ungrab console command
    53         this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&Mouse::ungrab, this), "ungrab"), false);
     59        ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(this);
     60        ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(this);
     61#endif
     62    }
     63
     64    Mouse::~Mouse()
     65    {
     66#ifdef ORXONOX_PLATFORM_LINUX
     67        ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(0);
     68        ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(0);
    5469#endif
    5570    }
Note: See TracChangeset for help on using the changeset viewer.