mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
is_mouse_open
This commit is contained in:
parent
71735a5ff4
commit
c760784dbb
@ -21,13 +21,26 @@
|
|||||||
// Function: MouseWatcher::has_mouse
|
// Function: MouseWatcher::has_mouse
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns true if the mouse is anywhere within the
|
// Description: Returns true if the mouse is anywhere within the
|
||||||
// window, false otherwise.
|
// window, false otherwise. Also see is_mouse_open().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE bool MouseWatcher::
|
INLINE bool MouseWatcher::
|
||||||
has_mouse() const {
|
has_mouse() const {
|
||||||
return _has_mouse;
|
return _has_mouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: MouseWatcher::is_mouse_open
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the mouse is within the window and
|
||||||
|
// not over some particular MouseWatcherRegion that is
|
||||||
|
// marked to suppress mouse events; that is, that the
|
||||||
|
// mouse is in open space within the window.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool MouseWatcher::
|
||||||
|
is_mouse_open() const {
|
||||||
|
return _has_mouse && !_suppressed;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: MouseWatcher::get_mouse
|
// Function: MouseWatcher::get_mouse
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
|||||||
@ -44,6 +44,7 @@ TypeHandle MouseWatcher::_button_events_type;
|
|||||||
MouseWatcher::
|
MouseWatcher::
|
||||||
MouseWatcher(const string &name) : DataNode(name) {
|
MouseWatcher(const string &name) : DataNode(name) {
|
||||||
_has_mouse = false;
|
_has_mouse = false;
|
||||||
|
_suppressed = false;
|
||||||
_current_region = (MouseWatcherRegion *)NULL;
|
_current_region = (MouseWatcherRegion *)NULL;
|
||||||
_button_down_region = (MouseWatcherRegion *)NULL;
|
_button_down_region = (MouseWatcherRegion *)NULL;
|
||||||
_button_down = false;
|
_button_down = false;
|
||||||
@ -526,12 +527,12 @@ transmit_data(NodeAttributes &data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool suppress_below = false;
|
_suppressed = false;
|
||||||
if (_current_region != (MouseWatcherRegion *)NULL) {
|
if (_current_region != (MouseWatcherRegion *)NULL) {
|
||||||
suppress_below = _current_region->get_suppress_below();
|
_suppressed = _current_region->get_suppress_below();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (suppress_below) {
|
if (_suppressed) {
|
||||||
// We used to suppress *everything* below, but on reflection we
|
// We used to suppress *everything* below, but on reflection we
|
||||||
// really only want to suppress the mouse position information.
|
// really only want to suppress the mouse position information.
|
||||||
// Button events must still get through.
|
// Button events must still get through.
|
||||||
|
|||||||
@ -65,6 +65,7 @@ PUBLISHED:
|
|||||||
bool remove_region(MouseWatcherRegion *region);
|
bool remove_region(MouseWatcherRegion *region);
|
||||||
|
|
||||||
INLINE bool has_mouse() const;
|
INLINE bool has_mouse() const;
|
||||||
|
INLINE bool is_mouse_open() const;
|
||||||
INLINE const LPoint2f &get_mouse() const;
|
INLINE const LPoint2f &get_mouse() const;
|
||||||
INLINE float get_mouse_x() const;
|
INLINE float get_mouse_x() const;
|
||||||
INLINE float get_mouse_y() const;
|
INLINE float get_mouse_y() const;
|
||||||
@ -122,6 +123,7 @@ private:
|
|||||||
Groups _groups;
|
Groups _groups;
|
||||||
|
|
||||||
bool _has_mouse;
|
bool _has_mouse;
|
||||||
|
bool _suppressed;
|
||||||
LPoint2f _mouse;
|
LPoint2f _mouse;
|
||||||
|
|
||||||
PT(MouseWatcherRegion) _current_region;
|
PT(MouseWatcherRegion) _current_region;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user