mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Adds features to GuiInputCtrl
This commit adds three new features to the GuiInputCtrl. All three default to off, so it is fully backward compatible with existing scripts. The new options are: sendAxisEvents – If true, the control will generate onAxisEvent() callbacks for all axis events. This is useful for binding joystick/controller axes to game actions. sendBreakEvents – If true, the control will generate onInputEvent() callbacks for SI_BREAK events for all keys and buttons. By default the callback is only triggered for break events on modifier keys. SendModifierEvents – If true SI_MAKE events for modifier keys will generate callbacks. By default, only the break events are sent for modifier keys.
This commit is contained in:
parent
6e60bf5fec
commit
8b14790c93
2 changed files with 95 additions and 34 deletions
|
|
@ -32,23 +32,31 @@
|
|||
/// to script. This is useful for implementing custom keyboard handling code.
|
||||
class GuiInputCtrl : public GuiMouseEventCtrl
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
bool mSendAxisEvents;
|
||||
bool mSendBreakEvents;
|
||||
bool mSendModifierEvents;
|
||||
|
||||
typedef GuiMouseEventCtrl Parent;
|
||||
|
||||
// GuiControl.
|
||||
virtual bool onWake();
|
||||
virtual void onSleep();
|
||||
public:
|
||||
|
||||
virtual bool onInputEvent( const InputEventInfo &event );
|
||||
|
||||
static void initPersistFields();
|
||||
typedef GuiMouseEventCtrl Parent;
|
||||
|
||||
DECLARE_CONOBJECT(GuiInputCtrl);
|
||||
DECLARE_CATEGORY( "Gui Other Script" );
|
||||
DECLARE_DESCRIPTION( "A control that locks the mouse and reports all keyboard input events to script." );
|
||||
GuiInputCtrl();
|
||||
|
||||
DECLARE_CALLBACK( void, onInputEvent, ( const char* device, const char* action, bool state ));
|
||||
// GuiControl.
|
||||
virtual bool onWake();
|
||||
virtual void onSleep();
|
||||
|
||||
virtual bool onInputEvent( const InputEventInfo &event );
|
||||
|
||||
static void initPersistFields();
|
||||
|
||||
DECLARE_CONOBJECT(GuiInputCtrl);
|
||||
DECLARE_CATEGORY( "Gui Other Script" );
|
||||
DECLARE_DESCRIPTION( "A control that locks the mouse and reports all input events to script." );
|
||||
|
||||
DECLARE_CALLBACK( void, onInputEvent, ( const char* device, const char* action, bool state ));
|
||||
DECLARE_CALLBACK(void, onAxisEvent, (const char* device, const char* action, F32 axisValue));
|
||||
};
|
||||
|
||||
#endif // _GUI_INPUTCTRL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue