mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
add set_force_mouse
This commit is contained in:
parent
f030c6333f
commit
82dc54634a
@ -476,6 +476,29 @@ get_ignore_mouse() const {
|
|||||||
return _ignore_mouse;
|
return _ignore_mouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DriveInterface::set_force_mouse
|
||||||
|
// Access: Published
|
||||||
|
// Description: Changes the state of the force_mouse flag. If this
|
||||||
|
// flag is true, the mouse button need not be held down
|
||||||
|
// in order to drive the avatar around.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DriveInterface::
|
||||||
|
set_force_mouse(bool force_mouse) {
|
||||||
|
_force_mouse = force_mouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DriveInterface::get_force_mouse
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns the current setting of the force_mouse flag.
|
||||||
|
// See set_force_mouse().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool DriveInterface::
|
||||||
|
get_force_mouse() const {
|
||||||
|
return _force_mouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DriveInterface::set_mat
|
// Function: DriveInterface::set_mat
|
||||||
|
@ -137,6 +137,7 @@ DriveInterface(const string &name) : DataNode(name) {
|
|||||||
|
|
||||||
_cs = default_coordinate_system;
|
_cs = default_coordinate_system;
|
||||||
_ignore_mouse = false;
|
_ignore_mouse = false;
|
||||||
|
_force_mouse = false;
|
||||||
|
|
||||||
_mods.add_button(MouseButton::one());
|
_mods.add_button(MouseButton::one());
|
||||||
_mods.add_button(MouseButton::two());
|
_mods.add_button(MouseButton::two());
|
||||||
@ -235,7 +236,7 @@ apply(double x, double y, bool any_button) {
|
|||||||
_speed = 0.0f;
|
_speed = 0.0f;
|
||||||
_rot_speed = 0.0f;
|
_rot_speed = 0.0f;
|
||||||
|
|
||||||
if (any_button) {
|
if (any_button || _force_mouse) {
|
||||||
// If we're holding down any of the mouse buttons, do this
|
// If we're holding down any of the mouse buttons, do this
|
||||||
// computation based on the mouse position.
|
// computation based on the mouse position.
|
||||||
|
|
||||||
|
@ -103,6 +103,9 @@ PUBLISHED:
|
|||||||
INLINE void set_ignore_mouse(bool ignore_mouse);
|
INLINE void set_ignore_mouse(bool ignore_mouse);
|
||||||
INLINE bool get_ignore_mouse() const;
|
INLINE bool get_ignore_mouse() const;
|
||||||
|
|
||||||
|
INLINE void set_force_mouse(bool force_mouse);
|
||||||
|
INLINE bool get_force_mouse() const;
|
||||||
|
|
||||||
void set_mat(const LMatrix4f &mat);
|
void set_mat(const LMatrix4f &mat);
|
||||||
const LMatrix4f &get_mat() const;
|
const LMatrix4f &get_mat() const;
|
||||||
|
|
||||||
@ -139,6 +142,7 @@ private:
|
|||||||
bool _is_force_roll;
|
bool _is_force_roll;
|
||||||
CoordinateSystem _cs;
|
CoordinateSystem _cs;
|
||||||
bool _ignore_mouse;
|
bool _ignore_mouse;
|
||||||
|
bool _force_mouse;
|
||||||
|
|
||||||
// Remember which mouse buttons are being held down.
|
// Remember which mouse buttons are being held down.
|
||||||
ModifierButtons _mods;
|
ModifierButtons _mods;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user