File size: 12,171 Bytes
24b81cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
/** @file */
// constants for device (binding device) type determine:
//
// EUAINPUT_DEVICE_KEYBOARD
// EUAINPUT_DEVICE_MOUSE
// EUAINPUT_DEVICE_KEYBOARDMOUSE
// EUAINPUT_DEVICE_CONTROLLER
// EUAINPUT_DEVICE_IR
// -------------------------------------------------------------------------
class UAIDWrapper
{
private void UAIDWrapper() {}
private void ~UAIDWrapper() {}
proto native UAInput InputP(); // get input pointer
};
// -------------------------------------------------------------------------
class UAInput
{
proto native int ID(); // return input index
proto native int NameHash(); // return input hash
proto native int BindingCount(); // return binding count
proto native int Binding( int iIndex ); // return binding at index
proto native void ClearBinding(); // remove all bindings
proto native void BindCombo( string sButtonName ); // bind combo to this input by name (single/ or append to existing button)
proto native void BindComboByHash( int iHash ); // bind combo to this input by hash (single/ or append to existing button)
proto native void AddAlternative(); // add new alternative keybind
proto native void ClearAlternative( int iIndex ); // clear binding alternative by index
proto native void SelectAlternative( int iIndex ); // select binding alternative by index
proto native int AlternativeCount(); // get currently assigned alternative count
proto native int AlternativeIndex(); // get currently selected alternative index
proto native void ClearDeviceBind( int iDeviceFlags ); // clear binding for specific device(s)
proto native int BindKeyCount(); // binded key count (for selected alternative)
proto native int GetBindKey( int iIndex ); // binded "control" at index (for selected alternative)
proto native int GetBindDevice( int iIndex ); // binded "control" device type at index (for selected alternative)
proto native bool CheckBindDevice( int iIndex, int iDeviceFlags ); // compare binded device "control" type :: EUAINPUT_DEVICE_KEYBOARD for example
proto native float LocalValue();
proto native bool LocalPress();
proto native bool LocalRelease();
proto native bool LocalHold();
proto native bool LocalHoldBegin();
proto native bool LocalDoubleClick();
proto native bool LocalClick();
proto native bool IsCombo(); // return true if there is currently combo bind - use Binding() result !!!
// normal state is there are no limits, input generates all the events
// but if there is an limiter,
proto native bool IsLimited(); // return true if there is an event limit
proto native bool IsLimitConditionActive(); // return true if event limits matches current control item activity
proto native bool IsPressLimit(); // if limited to PRESS
proto native bool IsReleaseLimit(); // if limited to RELEASE
proto native bool IsHoldLimit(); // if limited to HOLD
proto native bool IsHoldBeginLimit(); // if limited to HOLDBEGIN
proto native bool IsClickLimit(); // if limited to SINGLE CLICK
proto native bool IsDoubleClickLimit(); // if limited to DOUBLE CLICK
proto native bool HasSorting( int iIndex ); // has sorting group index?
proto native void Supress(); // supress press event for next frame (while not pressed ATM - otherwise until release)
proto native bool IsLocked(); // determine if locked (not active ATM)
proto native void Lock(); // lock (until unlock called or exclusion is selected)
proto native void Unlock(); // unlock exclusively
proto native int ConflictCount(); // get number of conflicts with other inputs
proto native void ForceEnable( bool bEnable ); // force enable on/ off
proto native void ForceDisable( bool bEnable ); // force disable on/ off
proto native void Backlit_Override( int eType, int iColor ); // enable/ disable backlit of associated controls (EUABACKLIT_*)
proto native bool Backlit_Enabled(); // check whether associated controls are backlit
proto native UAIDWrapper GetPersistentWrapper(); // create persistent object for input access
private void UAInput();
private void ~UAInput();
};
// -------------------------------------------------------------------------
class UAInterface
{
private void UAInterface() {}
private void ~UAInterface() {}
// getting action state
/**
\brief Get action state
@param action id of action, defined in \ref 4_World/Classes/UserActionsComponent/_constants.c
@param check_focus if true and game is unfocused, returns 0; otherwise returns actual value
@return actual action state as float, for regular two state buttons returns 0 or 1, for analog buttons/axes returns value in interval <0, 1> with consideration of defined deadzones
@see SyncedValue()
*/
proto native float SyncedValue_ID(int action, bool check_focus = true);
proto native float SyncedValue(string action, bool check_focus = true);
/**
\brief Returns true just in frame, when action was invoked (button was pressed)
@param action id of action, defined in \ref 4_World/Classes/UserActionsComponent/_constants.c
@param check_focus if true and game is unfocused, returns 0; otherwise returns actual value
@return true if action was invoked in that frame, false otherwise
@see SyncedPress()
*/
proto native bool SyncedPress_ID(int action, bool check_focus = true);
proto native bool SyncedPress(string action, bool check_focus = true);
/**
\brief Returns true just in frame, when release action happened (button was released)
@param action id of action, defined in \ref 4_World/Classes/UserActionsComponent/_constants.c
@param check_focus if true and game is unfocused, returns 0; otherwise returns actual value
@return true if action was released in that frame, false otherwise
@see SyncedRelease()
*/
proto native bool SyncedRelease_ID(int action, bool check_focus = true);
proto native bool SyncedRelease(string action, bool check_focus = true);
/**
\brief Returns true just in frame, when hold action invoked (button is hold)
@param action id of action, defined in \ref 4_World/Classes/UserActionsComponent/_constants.c
@param check_focus if true and game is unfocused, returns 0; otherwise returns actual value
@return true if action was released in that frame, false otherwise
@see SyncedHold()
*/
proto native bool SyncedHold_ID(int action, bool check_focus = true);
proto native bool SyncedHold(string action, bool check_focus = true);
/**
\brief Returns true just in frame, when double click action invoked (button double clicked)
@param action id of action, defined in \ref 4_World/Classes/UserActionsComponent/_constants.c
@param check_focus if true and game is unfocused, returns 0; otherwise returns actual value
@return true if action was released in that frame, false otherwise
@see SyncedDbl()
*/
proto native bool SyncedDbl_ID(int action, bool check_focus = true);
proto native bool SyncedDbl(string action, bool check_focus = true);
/**
\brief Returns true just in frame, when single click action invoked (button pressed and released before hold timer)
@param action id of action, defined in \ref 4_World/Classes/UserActionsComponent/_constants.c
@param check_focus if true and game is unfocused, returns 0; otherwise returns actual value
@return true if action was released in that frame, false otherwise
@see SyncedClick()
*/
proto native bool SyncedClick_ID(int action, bool check_focus = true);
proto native bool SyncedClick(string action, bool check_focus = true);
};
// -------------------------------------------------------------------------
class UAInputAPI
{
private void UAInputAPI() {}
private void ~UAInputAPI() {}
proto native void ListCurrentProfile();
proto native void ListCurrentPreset();
proto native void ListAvailableButtons();
proto native void ListActiveGroup();
proto native void GetActiveInputs( out TIntArray items ); //! returns list of all bindable (i.e. visible) inputs from the active group ('core' by default)
proto native UAInput GetInputByID( int iID );
proto native UAInput GetInputByName( string sInputName );
proto native owned string GetButtonName( int iHash ); // get localized name for any button hash
proto native owned string GetButtonIcon( int iHash ); // get associated icon path for any button hash
proto native int ModificatorCount(); // modificator count
proto native owned string GetModificatorName( int index ); // modificator name
// for options only mapping, do not call normally as it is not performance wise!
proto native int DeterminePressedButton(); // recently pressed key, mouse button or pad button (returns zero if nothing pressed)
proto native int DeterminedCount(); // all buttons (keys, etc.) pressed during determination test (call only when DeterminePressedButton() returned something !)
proto native int GetDetermined( int iIndex ); // total count of pressed buttons (call only when DeterminePressedButton() returned something !)
proto native UAInput RegisterInput( string sInputName, string sLoc, string sGroupName );
proto native void DeRegisterInput( string sInputName );
proto native void RegisterGroup( string sGroupName, string sLoc );
proto native void DeRegisterGroup( string sGroupName );
proto native void UpdateControls(); // call this on each change of exclusion
proto native void ActivateGroup( string sGroupName );
proto native void ActivateExclude( string sExcludeName );
proto native void ActivateContext( string sContextName );
proto native void ActivateModificator( string sModName );
proto native void DeactivateModificator( string sModName );
proto native void DeactivateContext();
proto native bool PresetCreateNew(); // create new dynamic preset from the selected one. False == cannot create new == too many presets (current max == 6)
proto native bool PresetDelete( int index ); // delete specific preset - (false == not deletable!)
proto native int PresetCurrent(); // determine index of current preset - (-1 == not selected)
proto native void PresetSelect( int index ); // select specific preset
/**
\brief Resets current 'main' preset without reverting anything else ('softer' Revert)
\note Does not reset dynamic presets, since they don't have any real defaults in the core PBOs.
*/
proto native void PresetReset();
proto native int PresetCount(); // count of presets
proto native owned string PresetName( int index ); // name of selected preset
proto native int SortingCount(); // sorting group count
proto native owned string SortingName( int index ); // sorting group name (different from localization!)
proto native owned string SortingLocalization( int index ); // sorting group localized name
proto native void Export(); // export XML (user) configuration
proto native void Revert(); // revert XML (user) configuration - all of it and use default PBO content! Auto-exports afterward.
proto native void SaveInputPresetMiscData(); // saves preset index on consoles, where the regular XMLs are unavailable
proto native void SupressNextFrame( bool bForce); // supress inputs for nextframe (until key release - call this when leaving main menu and alike - to avoid button collision after character control returned)
proto native void Backlit_None(); // turn off backlit
proto native void Backlit_Background( int eType, int iColor1, int iColor2 ); // start backlit
proto native void Backlit_Animation( string strName, float fLifeTime, int iColor1, int iColor2 ); // start backlit animation and after time limit -> continue with another one
proto native bool Backlit_Enabled(); // check whether backlit active
proto native void Backlit_KeyByHash( int uHash, int eLayer, int eType, int iColor ); // key directly (during keybinding process) (EUABACKLIT_*)
proto native void Backlit_KeyByName( string strName, int eLayer, int eType, int iColor ); // key directly (by name) (EUABACKLIT_*)
proto native void Backlit_Remove( int eLayer ); // turn off layer of backlit
proto native void Backlit_ForceUpdate(); // this forces update immediately - USE ONLY IN LOADING SEQUENCE !!!
proto native void Backlit_EmptyQueue(); // empty queue of animations - use if you want to play something immediately
};
proto native UAInputAPI GetUApi();
|