fix comments, reorder static init timing

This commit is contained in:
David Rose 2007-07-23 17:36:01 +00:00
parent a5ddc4961a
commit 5412780717
4 changed files with 37 additions and 22 deletions

View File

@ -46,6 +46,30 @@ ClockObject() {
_start_short_time = _true_clock->get_short_time(); _start_short_time = _true_clock->get_short_time();
_start_long_time = _true_clock->get_long_time(); _start_long_time = _true_clock->get_long_time();
_actual_frame_time = 0.0; _actual_frame_time = 0.0;
ConfigVariableDouble max_dt
("max-dt", -1.0,
PRC_DESC("Sets a limit on the value returned by ClockObject::get_dt(). If "
"this value is less than zero, no limit is imposed; "
"otherwise, this is the maximum value that will ever "
"be returned by get_dt(), regardless of how much time "
"has actually elapsed between frames. See ClockObject::set_dt()."));
ConfigVariableDouble clock_frame_rate
("clock-frame-rate", 1.0,
PRC_DESC("In non-real-time clock mode, sets the number of frames per "
"second that we should appear to be running. In forced "
"mode or limited mode, sets our target frame rate. In "
"normal mode, this has no effect. See ClockObject::set_frame_rate()."));
ConfigVariableDouble clock_degrade_factor
("clock-degrade-factor", 1.0,
PRC_DESC("In degrade clock mode, returns the ratio by which the "
"performance is degraded. A value of 2.0 causes the "
"clock to be slowed down by a factor of two (reducing "
"performance to 1/2 what would be otherwise). See ClockObject::set_degrade_factor()."));
ConfigVariableDouble average_frame_rate_interval
("average-frame-rate-interval", 1.0,
PRC_DESC("See ClockObject::set_average_frame_rate_interval()."));
_max_dt = max_dt; _max_dt = max_dt;
_user_frame_rate = clock_frame_rate; _user_frame_rate = clock_frame_rate;
_degrade_factor = clock_degrade_factor; _degrade_factor = clock_degrade_factor;

View File

@ -41,18 +41,19 @@ PUBLISHED:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : ClockObject // Class : ClockObject
// Description : A ClockObject keeps track of elapsed real time and // Description : A ClockObject keeps track of elapsed real time and
// discrete time. It can run in two modes: In normal // discrete time. In normal mode, get_frame_time()
// mode, get_frame_time() returns the time as of the // returns the time as of the last time tick() was
// last time tick() was called. This is the "discrete" // called. This is the "discrete" time, and is usually
// time, and is usually used to get the time as of, for // used to get the time as of, for instance, the
// instance, the beginning of the current frame. In // beginning of the current frame.
// non-real-time mode, get_frame_time() returns a
// constant increment since the last time tick() was
// called; this is useful when it is desirable to fake
// the clock out, for instance for non-real-time
// animation rendering.
// //
// In both modes, get_real_time() always returns the // In other modes, as set by set_mode() or the
// clock-mode config variable, get_frame_time() may
// return other values to simulate different timing
// effects, for instance to perform non-real-time
// animation. See set_mode().
//
// In all modes, get_real_time() always returns the
// elapsed real time in seconds since the ClockObject // elapsed real time in seconds since the ClockObject
// was constructed, or since it was last reset. // was constructed, or since it was last reset.
// //

View File

@ -113,13 +113,6 @@ get_sound_path() {
return sound_path; return sound_path;
} }
ConfigVariableDouble clock_frame_rate
("clock-frame-rate", 1.0);
ConfigVariableDouble clock_degrade_factor
("clock-degrade-factor", 1.0);
ConfigVariableDouble max_dt
("max-dt", -1.0);
ConfigVariableDouble sleep_precision ConfigVariableDouble sleep_precision
("sleep-precision", 0.01, ("sleep-precision", 0.01,
PRC_DESC("This is the accuracy within which we can expect select() to " PRC_DESC("This is the accuracy within which we can expect select() to "
@ -127,9 +120,6 @@ ConfigVariableDouble sleep_precision
"timeout of 1.0 seconds, we can expect to actually sleep for " "timeout of 1.0 seconds, we can expect to actually sleep for "
"somewhere between 1.0 and 1.0 + sleep-precision seconds.")); "somewhere between 1.0 and 1.0 + sleep-precision seconds."));
ConfigVariableDouble average_frame_rate_interval
("average-frame-rate-interval", 1.0);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: init_libputil // Function: init_libputil
// Description: Initializes the library. This must be called at // Description: Initializes the library. This must be called at

View File

@ -250,7 +250,7 @@ template<class Key, class Value, class Compare>
INLINE bool SimpleHashMap<Key, Value, Compare>:: INLINE bool SimpleHashMap<Key, Value, Compare>::
has_element(int n) const { has_element(int n) const {
nassertr(n >= 0 && n < (int)_table_size, false); nassertr(n >= 0 && n < (int)_table_size, false);
return get_exists_array()[n]; return (get_exists_array()[n] != 0);
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////