Add support for Controller Keys, inspired by similar code by CtrlAltStudio Viewer

Dear Alpha Users who are curious about this:
A = Alt
B = Shift
X = Ctrl
Y = Escape
Back = Toggle Flycam mode (Use this, it's fun!!!)
Start = Toggle Cursor mode
Right Stick Click = Toggle Mouselook
Left Stick Click = Jump/Fly

Enjoy, I know I do!
This commit is contained in:
Inusaito Sayori
2014-05-14 23:48:27 -04:00
parent 18a48e6609
commit e58f8856f4
3 changed files with 29 additions and 1 deletions

View File

@@ -113,6 +113,12 @@ public:
F32 getKeyElapsedTime( KEY key ); // Returns time in seconds since key was pressed.
S32 getKeyElapsedFrameCount( KEY key ); // Returns time in frames since key was pressed.
void setControllerKey(KEY key, bool level)
{
mControllerKeys[key] = mKeyLevel[key] = level;
(level ? mKeyDown[key] : mKeyUp[key]) = true;
}
protected:
void addKeyName(KEY key, const std::string& name);
@@ -127,6 +133,7 @@ protected:
BOOL mKeyRepeated[KEY_COUNT]; // Key was repeated
BOOL mKeyUp[KEY_COUNT]; // Up edge
BOOL mKeyDown[KEY_COUNT]; // Down edge
BOOL mControllerKeys[KEY_COUNT]; // Keys held in controller
KEY mCurTranslatedKey;
KEY mCurScanKey; // Used during the scanKeyboard()