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::_increment_active_count ( const Handle Channel, const Mask EventMask, ObsStruct &os) { if (EventMask & LocalAxisMask) { os.axisActiveCount++; if (os.axisActiveCount == 1) { HashTableHandleIterator it; ControllerStruct *cs (_controllerCache.get_first (it)); while (cs) { HashTableHandleIterator axisIt; InputEventAxis *event (cs->axisTable.get_first (axisIt)); while (event) { if (!is_zero32 (event->get_axis_value ())) { os.obs.receive_axis_event (Channel, *event); } event = cs->axisTable.get_next (axisIt); } cs = _controllerCache.get_next (it); } } } if (EventMask & LocalButtonMask) { os.buttonActiveCount++; if (os.buttonActiveCount == 1) { HashTableHandleIterator it; ControllerStruct *cs (_controllerCache.get_first (it)); while (cs) { HashTableHandleIterator buttonIt; InputEventButton *event (cs->buttonTable.get_first (buttonIt)); while (event) { if (event->get_button_value ()) { os.obs.receive_button_event (Channel, *event); } event = cs->buttonTable.get_next (buttonIt); } cs = _controllerCache.get_next (it); } } } if (EventMask & LocalKeyMask) { os.keyActiveCount++; if (os.keyActiveCount == 1) { HashTableHandleIterator it; InputEventKey *event (_keyCache.get_first (it)); while (event) { if (event->get_key_state ()) { os.obs.receive_key_event (Channel, *event); } event = _keyCache.get_next (it); } } } if (EventMask & LocalMouseMask) { os.mouseActiveCount++; if (os.mouseActiveCount == 1) { if (_mouseCache.get_button_mask ()) { os.obs.receive_mouse_event (Channel, _mouseCache); } } } if (EventMask & LocalSwitchMask) { os.switchActiveCount++; if (os.switchActiveCount == 1) { HashTableHandleIterator it; ControllerStruct *cs (_controllerCache.get_first (it)); while (cs) { HashTableHandleIterator switchIt; InputEventSwitch *event (cs->switchTable.get_first (switchIt)); while (event) { if (event->get_switch_value ()) { os.obs.receive_switch_event (Channel, *event); } event = cs->switchTable.get_next (switchIt); } cs = _controllerCache.get_next (it); } } } }