touch events
This commit is contained in:
parent
d2d2eb6b4b
commit
e1287b5005
|
|
@ -1599,68 +1599,68 @@ function __wbg_get_imports() {
|
|||
const ret = wasm.memory;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10072 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9474, __wbg_adapter_32);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10073 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9475, __wbg_adapter_32);
|
||||
const ret = makeMutClosure(arg0, arg1, 9474, __wbg_adapter_32);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10074 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9475, __wbg_adapter_32);
|
||||
const ret = makeMutClosure(arg0, arg1, 9474, __wbg_adapter_37);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10075 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9475, __wbg_adapter_37);
|
||||
const ret = makeMutClosure(arg0, arg1, 9474, __wbg_adapter_32);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10076 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9475, __wbg_adapter_32);
|
||||
const ret = makeMutClosure(arg0, arg1, 9474, __wbg_adapter_32);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10077 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9475, __wbg_adapter_32);
|
||||
const ret = makeMutClosure(arg0, arg1, 9474, __wbg_adapter_44);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10078 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9475, __wbg_adapter_44);
|
||||
const ret = makeMutClosure(arg0, arg1, 9474, __wbg_adapter_32);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper10079 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 9475, __wbg_adapter_32);
|
||||
imports.wbg.__wbindgen_closure_wrapper17891 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 13684, __wbg_adapter_49);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper17892 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 13685, __wbg_adapter_49);
|
||||
imports.wbg.__wbindgen_closure_wrapper19740 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14498, __wbg_adapter_52);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19741 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14499, __wbg_adapter_52);
|
||||
const ret = makeMutClosure(arg0, arg1, 14498, __wbg_adapter_52);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19742 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14499, __wbg_adapter_52);
|
||||
const ret = makeMutClosure(arg0, arg1, 14498, __wbg_adapter_52);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19743 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14499, __wbg_adapter_52);
|
||||
const ret = makeMutClosure(arg0, arg1, 14498, __wbg_adapter_59);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19744 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14499, __wbg_adapter_59);
|
||||
const ret = makeMutClosure(arg0, arg1, 14498, __wbg_adapter_52);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19745 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14499, __wbg_adapter_52);
|
||||
const ret = makeMutClosure(arg0, arg1, 14498, __wbg_adapter_52);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19746 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14499, __wbg_adapter_52);
|
||||
const ret = makeMutClosure(arg0, arg1, 14498, __wbg_adapter_52);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19747 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14499, __wbg_adapter_52);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper19875 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14570, __wbg_adapter_68);
|
||||
imports.wbg.__wbindgen_closure_wrapper19874 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 14569, __wbg_adapter_68);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,8 +2,9 @@
|
|||
use fyrox::{
|
||||
keyboard::PhysicalKey,
|
||||
asset::manager::ResourceManager,
|
||||
core::{pool::Handle, uuid::Uuid, TypeUuidProvider},
|
||||
event::{ElementState, Event, WindowEvent},
|
||||
core::{pool::Handle, uuid::Uuid, TypeUuidProvider, log::Log},
|
||||
event::{ElementState, Event, WindowEvent, TouchPhase},
|
||||
keyboard::KeyCode,
|
||||
gui::message::UiMessage,
|
||||
impl_component_provider,
|
||||
plugin::{Plugin, PluginConstructor, PluginContext, PluginRegistrationContext},
|
||||
|
|
@ -42,6 +43,38 @@ impl ScriptTrait for Player {
|
|||
self.key_checker(keycode, is_pressed);
|
||||
}
|
||||
}
|
||||
if let WindowEvent::Touch(touch) = event {
|
||||
match touch.phase {
|
||||
TouchPhase::Started => {
|
||||
if touch.location.x > 400.0 {
|
||||
self.key_checker(KeyCode::ArrowRight, true);
|
||||
self.key_checker(KeyCode::ArrowLeft, false);
|
||||
} else {
|
||||
self.key_checker(KeyCode::ArrowLeft, true);
|
||||
self.key_checker(KeyCode::ArrowRight, false);
|
||||
}
|
||||
if touch.location.y < 200.0 {
|
||||
self.key_checker(KeyCode::ArrowUp, true);
|
||||
}
|
||||
if touch.location.y > 200.0 {
|
||||
self.key_checker(KeyCode::ArrowUp, false);
|
||||
}
|
||||
},
|
||||
TouchPhase::Ended => {
|
||||
if touch.location.x > 400.0 {
|
||||
self.key_checker(KeyCode::ArrowRight, false);
|
||||
} else {
|
||||
self.key_checker(KeyCode::ArrowLeft, false);
|
||||
}
|
||||
if touch.location.y < 200.0 {
|
||||
self.key_checker(KeyCode::ArrowUp, false);
|
||||
}
|
||||
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
//Log::err(format!("{:?}", touch.location))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue