Panda3D
|
Records a button event of some kind. More...
#include <pandadoc.hpp>
Public Types | |
enum | Type { T_down = 0 , T_resume_down = 1 , T_up = 2 , T_repeat = 3 , T_keystroke = 4 , T_candidate = 5 , T_move = 6 , T_raw_down = 7 , T_raw_up = 8 } |
Public Member Functions | |
bool | operator!= (const ButtonEvent other) |
bool | operator< (const ButtonEvent other) |
bool | operator== (const ButtonEvent other) |
Public Attributes | |
ButtonHandle | button |
int | keycode |
double | time |
ButtonEvent::Type | type |
Records a button event of some kind.
This is either a keyboard or mouse button (or some other kind of button) changing state from up to down, or vice-versa, or it is a single "keystroke".
A keystroke is different than a button event in that (a) it does not necessarily correspond to a physical button on a keyboard, but might be the result of a combination of buttons (e.g. "A" is the result of shift + "a"); and (b) it does not manage separate "up" and "down" events, but is itself an instantaneous event.
Normal up/down button events can be used to track the state of a particular button on the keyboard, while keystroke events are best used to monitor what a user is attempting to type.
Button up/down events are defined across all the physical keys on the keyboard (and other buttons for which there is a corresponding ButtonHandle object), while keystroke events are defined across the entire Unicode character set.
This API should not be considered stable and may change in a future version of Panda3D.
enum Type |
Enumerator | |
---|---|
T_down | T_down is sent when a button was just pressed. |
T_resume_down | T_resume_down is a special event that is only thrown when focus is returned to a window and a button is detected as being held down at that point; it indicates that the button should be considered down now (if it wasn't already), but it didn't just get pressed down at this moment, it was depressed some time ago. It's mainly used for correct tracking of modifier keys like shift and control, and can be ignored for other keys. |
T_up | T_down is sent when a button is released. |
T_repeat | T_repeat is sent for each a keyrepeat event generated by the system, for a button that is continually held down. If you want to respect keyrepeat, treat T_down and T_repeat equivalently. |
T_keystroke | T_keystroke is a special keystroke event, and is sent along with a Unicode keycode value, not a ButtonHandle. |
T_candidate | T_candidate is used to indicate that the user is using the IME and has in the process of selecting some possible text to type from a menu. |
T_move | T_move is used to indicate that the mouse has moved within the current region. Button drag mode needs this, others may ignore this event. |
T_raw_down | T_raw_down is usually sent together with T_down, except that this is the original, untransformed scan key sent by the keyboard. It is not altered by modifier keys and acts as if the user is using the US (qwerty) keyboard layout. |
T_raw_up |
bool operator!= | ( | const ButtonEvent | other | ) |
bool operator< | ( | const ButtonEvent | other | ) |
bool operator== | ( | const ButtonEvent | other | ) |
ButtonHandle button |
int keycode |
double time |
ButtonEvent::Type type |