mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
set_stop_this_frame
This commit is contained in:
parent
a40db65782
commit
e6a55b9590
@ -431,3 +431,30 @@ INLINE bool DriveInterface::
|
|||||||
get_force_mouse() const {
|
get_force_mouse() const {
|
||||||
return _force_mouse;
|
return _force_mouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DriveInterface::set_stop_this_frame
|
||||||
|
// Access: Published
|
||||||
|
// Description: If stop_this_frame is true, the next time the frame
|
||||||
|
// is computed no motion will be allowed, and then the
|
||||||
|
// flag is reset to false. This can be used to prevent
|
||||||
|
// too much movement when we know a long time has
|
||||||
|
// artificially elapsed, for instance when we take a
|
||||||
|
// screenshot, without munging the clock for everything
|
||||||
|
// else.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DriveInterface::
|
||||||
|
set_stop_this_frame(bool stop_this_frame) {
|
||||||
|
_stop_this_frame = stop_this_frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DriveInterface::get_stop_this_frame
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns the current setting of the stop_this_frame
|
||||||
|
// flag. See set_stop_this_frame().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool DriveInterface::
|
||||||
|
get_stop_this_frame() const {
|
||||||
|
return _stop_this_frame;
|
||||||
|
}
|
||||||
|
@ -139,6 +139,7 @@ DriveInterface(const string &name) :
|
|||||||
|
|
||||||
_ignore_mouse = false;
|
_ignore_mouse = false;
|
||||||
_force_mouse = false;
|
_force_mouse = false;
|
||||||
|
_stop_this_frame = false;
|
||||||
|
|
||||||
_mods.add_button(MouseButton::one());
|
_mods.add_button(MouseButton::one());
|
||||||
_mods.add_button(MouseButton::two());
|
_mods.add_button(MouseButton::two());
|
||||||
@ -345,6 +346,11 @@ apply(double x, double y, bool any_button) {
|
|||||||
// Now how far did we move based on the amount of time elapsed?
|
// Now how far did we move based on the amount of time elapsed?
|
||||||
float distance = ClockObject::get_global_clock()->get_dt() * _speed;
|
float distance = ClockObject::get_global_clock()->get_dt() * _speed;
|
||||||
float rotation = ClockObject::get_global_clock()->get_dt() * _rot_speed;
|
float rotation = ClockObject::get_global_clock()->get_dt() * _rot_speed;
|
||||||
|
if (_stop_this_frame) {
|
||||||
|
distance = 0.0f;
|
||||||
|
rotation = 0.0f;
|
||||||
|
_stop_this_frame = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Now apply the vectors.
|
// Now apply the vectors.
|
||||||
|
|
||||||
|
@ -97,6 +97,9 @@ PUBLISHED:
|
|||||||
INLINE void set_force_mouse(bool force_mouse);
|
INLINE void set_force_mouse(bool force_mouse);
|
||||||
INLINE bool get_force_mouse() const;
|
INLINE bool get_force_mouse() const;
|
||||||
|
|
||||||
|
INLINE void set_stop_this_frame(bool stop_this_frame);
|
||||||
|
INLINE bool get_stop_this_frame() const;
|
||||||
|
|
||||||
void set_mat(const LMatrix4f &mat);
|
void set_mat(const LMatrix4f &mat);
|
||||||
const LMatrix4f &get_mat();
|
const LMatrix4f &get_mat();
|
||||||
|
|
||||||
@ -128,6 +131,7 @@ private:
|
|||||||
LVector3f _vel;
|
LVector3f _vel;
|
||||||
bool _ignore_mouse;
|
bool _ignore_mouse;
|
||||||
bool _force_mouse;
|
bool _force_mouse;
|
||||||
|
bool _stop_this_frame;
|
||||||
|
|
||||||
// This is only used to return a temporary value in get_mat().
|
// This is only used to return a temporary value in get_mat().
|
||||||
LMatrix4f _mat;
|
LMatrix4f _mat;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user