mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
event: Expose ButtonEvent to Python
This commit is contained in:
parent
2abf867203
commit
980399d142
@ -149,3 +149,35 @@ update_mods(ModifierButtons &mods) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
INLINE ButtonHandle ButtonEvent::
|
||||||
|
get_button() const {
|
||||||
|
return _button;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
INLINE int ButtonEvent::
|
||||||
|
get_keycode() const {
|
||||||
|
return _keycode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
INLINE ButtonEvent::Type ButtonEvent::
|
||||||
|
get_type() const {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
INLINE double ButtonEvent::
|
||||||
|
get_time() const {
|
||||||
|
return _time;
|
||||||
|
}
|
||||||
|
@ -44,7 +44,7 @@ class DatagramIterator;
|
|||||||
* character set.
|
* character set.
|
||||||
*/
|
*/
|
||||||
class EXPCL_PANDA_EVENT ButtonEvent {
|
class EXPCL_PANDA_EVENT ButtonEvent {
|
||||||
public:
|
PUBLISHED:
|
||||||
enum Type {
|
enum Type {
|
||||||
// T_down is sent when a button was just pressed.
|
// T_down is sent when a button was just pressed.
|
||||||
T_down,
|
T_down,
|
||||||
@ -85,6 +85,7 @@ public:
|
|||||||
T_raw_up,
|
T_raw_up,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
INLINE ButtonEvent();
|
INLINE ButtonEvent();
|
||||||
INLINE ButtonEvent(ButtonHandle button, Type type, double time = ClockObject::get_global_clock()->get_frame_time());
|
INLINE ButtonEvent(ButtonHandle button, Type type, double time = ClockObject::get_global_clock()->get_frame_time());
|
||||||
INLINE ButtonEvent(int keycode, double time = ClockObject::get_global_clock()->get_frame_time());
|
INLINE ButtonEvent(int keycode, double time = ClockObject::get_global_clock()->get_frame_time());
|
||||||
@ -93,17 +94,30 @@ public:
|
|||||||
INLINE ButtonEvent(const ButtonEvent ©);
|
INLINE ButtonEvent(const ButtonEvent ©);
|
||||||
INLINE void operator = (const ButtonEvent ©);
|
INLINE void operator = (const ButtonEvent ©);
|
||||||
|
|
||||||
|
PUBLISHED:
|
||||||
INLINE bool operator == (const ButtonEvent &other) const;
|
INLINE bool operator == (const ButtonEvent &other) const;
|
||||||
INLINE bool operator != (const ButtonEvent &other) const;
|
INLINE bool operator != (const ButtonEvent &other) const;
|
||||||
INLINE bool operator < (const ButtonEvent &other) const;
|
INLINE bool operator < (const ButtonEvent &other) const;
|
||||||
|
|
||||||
|
public:
|
||||||
INLINE bool update_mods(ModifierButtons &mods) const;
|
INLINE bool update_mods(ModifierButtons &mods) const;
|
||||||
|
|
||||||
|
INLINE ButtonHandle get_button() const;
|
||||||
|
INLINE int get_keycode() const;
|
||||||
|
INLINE Type get_type() const;
|
||||||
|
INLINE double get_time() const;
|
||||||
|
|
||||||
void output(std::ostream &out) const;
|
void output(std::ostream &out) const;
|
||||||
|
|
||||||
void write_datagram(Datagram &dg) const;
|
void write_datagram(Datagram &dg) const;
|
||||||
void read_datagram(DatagramIterator &scan);
|
void read_datagram(DatagramIterator &scan);
|
||||||
|
|
||||||
|
PUBLISHED:
|
||||||
|
MAKE_PROPERTY(button, get_button);
|
||||||
|
MAKE_PROPERTY(keycode, get_keycode);
|
||||||
|
MAKE_PROPERTY(type, get_type);
|
||||||
|
MAKE_PROPERTY(time, get_time);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// _button will be filled in if type is T_down, T_resume_down, or T_up.
|
// _button will be filled in if type is T_down, T_resume_down, or T_up.
|
||||||
ButtonHandle _button;
|
ButtonHandle _button;
|
||||||
|
@ -47,6 +47,8 @@ PUBLISHED:
|
|||||||
virtual void output(std::ostream &out) const;
|
virtual void output(std::ostream &out) const;
|
||||||
void write(std::ostream &out, int indent_level = 0) const;
|
void write(std::ostream &out, int indent_level = 0) const;
|
||||||
|
|
||||||
|
MAKE_SEQ_PROPERTY(events, get_num_events, get_event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef pvector<ButtonEvent> Events;
|
typedef pvector<ButtonEvent> Events;
|
||||||
Events _events;
|
Events _events;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user