Panda3D
 All Classes Functions Variables Enumerations
clientBase.I
1 // Filename: clientBase.I
2 // Created by: drose (25Jan01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 
17 ////////////////////////////////////////////////////////////////////
18 // Function: ClientBase::is_forked
19 // Access: Public
20 // Description: Returns true if the ClientBase has been forked (and,
21 // therefore, poll() does not need to be called), false
22 // otherwise.
23 ////////////////////////////////////////////////////////////////////
24 INLINE bool ClientBase::
25 is_forked() const {
26  return _forked;
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: ClientBase::poll
31 // Access: Public
32 // Description: Initiates a poll of the client devices, if we are not
33 // forked and if we have not already polled this frame.
34 // Returns true if the poll occurred, or false if it did
35 // not.
36 ////////////////////////////////////////////////////////////////////
37 INLINE bool ClientBase::
38 poll() {
39  if (_forked ||
40  _last_poll_frame == ClockObject::get_global_clock()->get_frame_count()) {
41  return false;
42  }
43 
44  do_poll();
45  return true;
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: ClientBase::get_last_poll_time
50 // Access: Public
51 // Description: Returns the time (according to the global
52 // ClockObject's get_real_time() method) of the last
53 // device poll.
54 ////////////////////////////////////////////////////////////////////
55 INLINE double ClientBase::
57  return _last_poll_time;
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: ClientBase::set_coordinate_system
62 // Access: Published
63 // Description: Specifies the coordinate system that all devices
64 // associated with this client will operate in.
65 // Normally, this is CS_default.
66 ////////////////////////////////////////////////////////////////////
67 void ClientBase::
68 set_coordinate_system(CoordinateSystem cs) {
69  _cs = cs;
70 }
71 
72 ////////////////////////////////////////////////////////////////////
73 // Function: ClientBase::get_coordinate_system
74 // Access: Published
75 // Description: Returns the coordinate system that all devices
76 // associated with this client will operate in.
77 // Normally, this is CS_default.
78 ////////////////////////////////////////////////////////////////////
79 INLINE CoordinateSystem ClientBase::
81  return _cs;
82 }
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
Definition: clockObject.I:271
bool is_forked() const
Returns true if the ClientBase has been forked (and, therefore, poll() does not need to be called)...
Definition: clientBase.I:25
double get_last_poll_time() const
Returns the time (according to the global ClockObject's get_real_time() method) of the last device po...
Definition: clientBase.I:56
void set_coordinate_system(CoordinateSystem cs)
Specifies the coordinate system that all devices associated with this client will operate in...
Definition: clientBase.I:68
bool poll()
Initiates a poll of the client devices, if we are not forked and if we have not already polled this f...
Definition: clientBase.I:38
CoordinateSystem get_coordinate_system() const
Returns the coordinate system that all devices associated with this client will operate in...
Definition: clientBase.I:80