26 AnalogNode(
ClientBase *client,
const std::string &device_name) :
29 _xy_output = define_output(
"xy", EventStoreVec2::get_class_type());
32 nassertv(client !=
nullptr);
34 client->get_device(ClientAnalogDevice::get_class_type(), device_name);
36 if (device ==
nullptr) {
38 <<
"Unable to open analog device " << device_name <<
"\n";
42 if (!device->is_of_type(ClientAnalogDevice::get_class_type())) {
44 <<
"Inappropriate device type " << device->get_type()
45 <<
" created; expected a ClientAnalogDevice.\n";
60 _xy_output = define_output(
"xy", EventStoreVec2::get_class_type());
63 nassertv(device !=
nullptr);
80 write(std::ostream &out,
int indent_level)
const {
81 DataNode::write(out, indent_level);
83 if (_analog !=
nullptr) {
84 _analog->write_axes(out, indent_level + 2);
102 LPoint2 out(0.0f, 0.0f);
103 for (
int i = 0; i < max_outputs; i++) {
104 if (_outputs[i]._index >= 0) {
107 if (_outputs[i]._flip) {
108 out[i] = -state.value;
110 out[i] = state.value;