27 VrpnButton(
const std::string &button_name, vrpn_Connection *connection) :
28 _button_name(button_name)
30 _button =
new vrpn_Button_Remote(_button_name.c_str(), connection);
32 _button->register_change_handler((
void*)
this, &vrpn_button_callback);
49 if (vrpn_cat.is_debug()) {
50 vrpn_cat.debug() << *
this <<
" marking " << *device <<
"\n";
52 _devices.push_back(device);
61 if (vrpn_cat.is_debug()) {
62 vrpn_cat.debug() << *
this <<
" unmarking " << *device <<
"\n";
65 Devices::iterator di =
66 find(_devices.begin(), _devices.end(), device);
68 if (di != _devices.end()) {
77 output(std::ostream &out)
const {
85 write(std::ostream &out,
int indent_level)
const {
88 << _devices.size() <<
" devices)\n";
95 void VRPN_CALLBACK VrpnButton::
96 vrpn_button_callback(
void *userdata,
const vrpn_BUTTONCB info) {
98 if (vrpn_cat.is_debug()) {
100 << *
self <<
" got button " << info.button <<
" = " << info.state <<
"\n";
103 Devices::iterator di;
104 for (di = self->_devices.begin(); di !=
self->_devices.end(); ++di) {
106 device->button_changed(info.button, info.state != 0);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.