Panda3D
 All Classes Functions Variables Enumerations
pointerEventList.I
1 // Filename: pointerEventList.I
2 // Created by: jyelon (20Sep2007)
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 // Function: PointerEventList::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE PointerEventList::
22 PointerEventList() {
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: PointerEventList::Copy Constructor
27 // Access: Public
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 INLINE PointerEventList::
31 PointerEventList(const PointerEventList &copy) :
32  _events(copy._events)
33 {
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: PointerEventList::Copy Assignment Operator
38 // Access: Public
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 INLINE void PointerEventList::
42 operator = (const PointerEventList &copy) {
43  _events = copy._events;
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: PointerEventList::get_num_events
48 // Access: Published
49 // Description: Returns the number of events in the list.
50 ////////////////////////////////////////////////////////////////////
51 INLINE int PointerEventList::
52 get_num_events() const {
53  return _events.size();
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: PointerEventList::get_in_window
58 // Access: Published
59 // Description: Get the in-window flag of the nth event.
60 ////////////////////////////////////////////////////////////////////
61 INLINE bool PointerEventList::
62 get_in_window(int evt) const {
63  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
64  return _events[evt]._in_window;
65 }
66 
67 ////////////////////////////////////////////////////////////////////
68 // Function: PointerEventList::get_xpos
69 // Access: Published
70 // Description: Get the x-coordinate of the nth event.
71 ////////////////////////////////////////////////////////////////////
72 INLINE int PointerEventList::
73 get_xpos(int evt) const {
74  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
75  return _events[evt]._xpos;
76 }
77 
78 ////////////////////////////////////////////////////////////////////
79 // Function: PointerEventList::get_ypos
80 // Access: Published
81 // Description: Get the y-coordinate of the nth event.
82 ////////////////////////////////////////////////////////////////////
83 INLINE int PointerEventList::
84 get_ypos(int evt) const {
85  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
86  return _events[evt]._ypos;
87 }
88 
89 ////////////////////////////////////////////////////////////////////
90 // Function: PointerEventList::get_dx
91 // Access: Published
92 // Description: Get the x-coordinate of the nth event.
93 ////////////////////////////////////////////////////////////////////
94 INLINE int PointerEventList::
95 get_dx(int evt) const {
96  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
97  return _events[evt]._dx;
98 }
99 
100 ////////////////////////////////////////////////////////////////////
101 // Function: PointerEventList::get_dy
102 // Access: Published
103 // Description: Get the y-coordinate of the nth event.
104 ////////////////////////////////////////////////////////////////////
105 INLINE int PointerEventList::
106 get_dy(int evt) const {
107  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
108  return _events[evt]._dy;
109 }
110 
111 ////////////////////////////////////////////////////////////////////
112 // Function: PointerEventList::get_length
113 // Access: Published
114 // Description: Get the length of the nth event.
115 ////////////////////////////////////////////////////////////////////
116 INLINE double PointerEventList::
117 get_length(int evt) const {
118  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
119  return _events[evt]._length;
120 }
121 
122 ////////////////////////////////////////////////////////////////////
123 // Function: PointerEventList::get_direction
124 // Access: Published
125 // Description: Get the direction of the nth event.
126 ////////////////////////////////////////////////////////////////////
127 INLINE double PointerEventList::
128 get_direction(int evt) const {
129  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
130  return _events[evt]._direction;
131 }
132 
133 ////////////////////////////////////////////////////////////////////
134 // Function: PointerEventList::get_rotation
135 // Access: Published
136 // Description: Get the rotation of the nth event.
137 ////////////////////////////////////////////////////////////////////
138 INLINE double PointerEventList::
139 get_rotation(int evt) const {
140  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
141  return _events[evt]._rotation;
142 }
143 
144 ////////////////////////////////////////////////////////////////////
145 // Function: PointerEventList::get_sequence
146 // Access: Published
147 // Description: Get the sequence number of the nth event.
148 ////////////////////////////////////////////////////////////////////
149 INLINE int PointerEventList::
150 get_sequence(int evt) const {
151  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
152  return _events[evt]._sequence;
153 }
154 
155 ////////////////////////////////////////////////////////////////////
156 // Function: PointerEventList::get_time
157 // Access: Published
158 // Description: Get the timestamp of the nth event.
159 ////////////////////////////////////////////////////////////////////
160 INLINE double PointerEventList::
161 get_time(int evt) const {
162  nassertr((evt >= 0) && (evt < (int)_events.size()), 0);
163  return _events[evt]._time;
164 }
165 
166 ////////////////////////////////////////////////////////////////////
167 // Function: PointerEventList::clear
168 // Access: Public
169 // Description: Empties all the events from the list.
170 ////////////////////////////////////////////////////////////////////
171 INLINE void PointerEventList::
172 clear() {
173  _events.clear();
174 }
175 
176 ////////////////////////////////////////////////////////////////////
177 // Function: PointerEventList::pop_front
178 // Access: Public
179 // Description: Discards the first event on the list.
180 ////////////////////////////////////////////////////////////////////
181 INLINE void PointerEventList::
183  _events.pop_front();
184 }
bool get_in_window(int n) const
Get the in-window flag of the nth event.
int get_xpos(int n) const
Get the x-coordinate of the nth event.
int get_sequence(int n) const
Get the sequence number of the nth event.
void clear()
Empties all the events from the list.
Records a set of pointer events that happened recently.
int get_dy(int n) const
Get the y-coordinate of the nth event.
double get_length(int n) const
Get the length of the nth event.
int get_num_events() const
Returns the number of events in the list.
double get_direction(int n) const
Get the direction of the nth event.
int get_ypos(int n) const
Get the y-coordinate of the nth event.
int get_dx(int n) const
Get the x-coordinate of the nth event.
void pop_front()
Discards the first event on the list.
double get_rotation(int n) const
Get the rotation of the nth event.
double get_time(int n) const
Get the timestamp of the nth event.