mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
tform: Add MouseWatcher::is_raw_button_down()
This commit is contained in:
parent
95b62ff198
commit
b5e92e29f5
@ -144,6 +144,15 @@ is_button_down(ButtonHandle button) const {
|
||||
return _inactivity_state != IS_inactive && _current_buttons_down.get_bit(button.get_index());
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to is_button_down(), but uses the raw button handle as reported by
|
||||
* the raw- prefixed events, and is not subject to the inactivity timer.
|
||||
*/
|
||||
INLINE bool MouseWatcher::
|
||||
is_raw_button_down(ButtonHandle button) const {
|
||||
return _current_raw_buttons_down.get_bit(button.get_index());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pattern string that indicates how the event names are generated
|
||||
* when a button is depressed. This is a string that may contain any of the
|
||||
|
@ -1427,8 +1427,12 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input,
|
||||
break;
|
||||
|
||||
case ButtonEvent::T_raw_down:
|
||||
_current_raw_buttons_down.set_bit(be._button.get_index());
|
||||
new_button_events.add_event(be);
|
||||
break;
|
||||
|
||||
case ButtonEvent::T_raw_up:
|
||||
// These are passed through.
|
||||
_current_raw_buttons_down.clear_bit(be._button.get_index());
|
||||
new_button_events.add_event(be);
|
||||
break;
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ PUBLISHED:
|
||||
MouseWatcherRegion *get_over_region(const LPoint2 &pos) const;
|
||||
|
||||
INLINE bool is_button_down(ButtonHandle button) const;
|
||||
INLINE bool is_raw_button_down(ButtonHandle button) const;
|
||||
|
||||
INLINE void set_button_down_pattern(const std::string &pattern);
|
||||
INLINE const std::string &get_button_down_pattern() const;
|
||||
@ -214,6 +215,7 @@ private:
|
||||
LPoint2 _mouse;
|
||||
LPoint2 _mouse_pixel;
|
||||
BitArray _current_buttons_down;
|
||||
BitArray _current_raw_buttons_down;
|
||||
|
||||
LVecBase4 _frame;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user