void dmz::EntityPluginGroundSimple::receive_button_event ( const Handle Channel, const InputEventButton &Value) { if ((Value.get_button_id () == 1) && Value.get_button_value ()) { const Float64 Time (_time.get_frame_time ()); if (!(_move.turboModifier > 0.0) && (Time > _move.turboRefillTime)) { _move.turboModifier = _move.turboBoost; _move.turboEndTime = Time + _move.turboDuration; } } else if ((Value.get_button_id () == 3) && Value.get_button_value ()) { ObjectModule *objMod (get_object_module ()); if (objMod) { Vector pos; Matrix ori; objMod->lookup_position (_hil, _defaultHandle, pos); objMod->lookup_orientation (_hil, _defaultHandle, ori); _log.out << "\n<position x=\"" << pos.get_x () << "\" y=\"" << pos.get_y () << "\" z=\"" << pos.get_z () << "\"/>\n"; _log.out << "<orientation\n"; Float64 array[9]; ori.to_array (array); for (Int32 ix = 0; ix < 9; ix++) { if (!(ix % 3)) { _log.out << " "; } _log.out << " v" << ix << "=\"" << array[ix] << "\""; if (!((ix + 1) % 3)) { _log.out << "\n"; } } _log.out << "/>" << endl; } } }
void dmz::WeaponPluginFixedLauncher::receive_button_event ( const Handle Channel, const InputEventButton &Value) { if (_hil) { if (Value.get_button_id () == _launchButton) { LaunchStruct *ls (_get_struct (_hil)); if (ls) { if (Value.get_button_value ()) { const Float64 CTime (_time.get_frame_time ()); ls->activeCount++; if (CTime > (ls->lastLaunchTime + _delay)) { _create_munition (ls->Source); ls->lastLaunchTime = CTime; } } else { ls->activeCount--; } } } } }
void dmz::JsExtV8Input::receive_button_event ( const Handle Channel, const InputEventButton &Value) { if (_v8Context.IsEmpty () == false) { v8::Context::Scope cscope(_v8Context); v8::HandleScope scope; V8Object event = v8::Object::New (); event->Set (_sourceStr, v8::Integer::New (Value.get_source_handle ())); event->Set (_idStr, v8::Integer::New (Value.get_button_id ())); event->Set (_valueStr, v8::Boolean::New (Value.get_button_value ())); event->Set (_previousStr, v8::Boolean::New (Value.get_button_previous_value ())); const int Argc (3); V8Value argv[Argc]; argv[0] = v8::Integer::New (Channel); argv[1] = event; _do_all_callbacks (Argc, argv, _buttonTable); } }
void dmz::ExPluginInput::receive_button_event ( const UInt32 Channel, const InputEventButton &Value) { _log.out << "[receive_button_event] channel: " << Channel << " source: " << Value.get_source_handle () << " button: " << Value.get_button_id () << " value: " << (Value.get_button_value () ? "Down" : "Up") << endl; }
void dmz::InputModuleBasic::send_button_event (const InputEventButton &Event) { if (_inEvent) { _que_event (new ButtonQueStruct (Event)); } else { _inEvent = True; _eventCount++; HashTableHandleIterator it; ChannelStruct *cs (_channelTable.get_first (it)); ControllerStruct *controller (_get_controller (Event.get_source_handle ())); if (controller) { InputEventButton *tmp (controller->buttonTable.lookup (Event.get_button_id ())); if (tmp) { if (*tmp != Event) { *tmp = Event; } else { cs = 0; } // event already sent; don't send again } else { tmp = new InputEventButton (Event); if (tmp && !controller->buttonTable.store (Event.get_button_id (), tmp)) { delete tmp; tmp = 0; } } } while (cs) { if (cs->active) { HashTableHandleIterator osIt; ObsStruct *os (cs->buttonTable.get_first (osIt)); while (os) { if (os->eventCount != _eventCount) { os->obs.receive_button_event (cs->ChannelHandle, Event); os->eventCount = _eventCount; } os = cs->buttonTable.get_next (osIt); } } cs = _channelTable.get_next (it); } _inEvent = False; _do_qued_events (); } }