28 INLINE std::string InputDevice::
38 INLINE std::string InputDevice::
39 get_manufacturer()
const {
48 INLINE std::string InputDevice::
49 get_serial_number()
const {
51 return _serial_number;
58 INLINE
unsigned short InputDevice::
59 get_vendor_id()
const {
68 INLINE
unsigned short InputDevice::
69 get_product_id()
const {
78 INLINE
bool InputDevice::
79 is_connected()
const {
88 INLINE InputDevice::DeviceClass InputDevice::
89 get_device_class()
const {
100 return (_features & (1 << (
unsigned int)feature)) != 0;
123 INLINE
bool InputDevice::
124 has_tracker()
const {
141 INLINE
bool InputDevice::
142 has_battery()
const {
151 get_tracker()
const {
153 return _tracker_data;
161 get_battery()
const {
163 return _battery_data;
172 INLINE
size_t InputDevice::
173 get_num_buttons()
const {
175 return _buttons.size();
191 if (index >= _buttons.size()) {
195 _buttons[index].handle = button;
205 if (index < _buttons.size()) {
206 return _buttons[index].handle;
208 return ButtonHandle::none();
218 if (index < _buttons.size()) {
219 return (_buttons[index]._state == S_down);
231 if (index < _buttons.size()) {
232 return _buttons[index]._state != S_unknown;
244 nassertr_always(index < _buttons.size(), ButtonState());
245 return _buttons[index];
254 for (
size_t i = 0; i < _buttons.size(); ++i) {
255 if (_buttons[i].handle == handle) {
266 INLINE
size_t InputDevice::
267 get_num_axes()
const {
281 if (index >= _axes.size()) {
285 _axes[index].axis = axis;
295 if (index < _axes.size()) {
296 return _axes[index].value;
308 nassertr_always(index < _axes.size(), AxisState());
318 for (
size_t i = 0; i < _axes.size(); ++i) {
319 if (_axes[i].axis == axis) {
332 if (index < _axes.size()) {
333 return _axes[index].known;
347 do_set_vibration(std::max(std::min(strong, 1.0), 0.0), std::max(std::min(weak, 1.0), 0.0));
356 _enable_pointer_events =
true;
365 _enable_pointer_events =
false;
366 _pointer_events.clear();
373 INLINE
void InputDevice::
374 enable_feature(Feature feature) {
375 _features |= (1 << (
unsigned int)feature);
385 _is_connected = connected;
391 INLINE InputDevice::ButtonState::
399 ALWAYS_INLINE
bool InputDevice::ButtonState::
401 return (_state != S_unknown);
407 ALWAYS_INLINE
bool InputDevice::ButtonState::
409 return (_state == S_down);
Records a set of pointer events that happened recently.
Similar to MutexHolder, but for a light mutex.
Stores the kinds of data that a tracker might output.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.