Skip to content
Snippets Groups Projects
Verified Commit ed99cf11 authored by Louis's avatar Louis :fire:
Browse files

Update to bevy 0.13

parent e093d3a4
No related branches found
No related tags found
No related merge requests found
[package]
name = "micro_bevy_web_utils"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
description = "Utilities for patching various missing parts from Bevy web/touch support"
authors = [
......@@ -11,9 +11,10 @@ homepage = "https://lab.lcr.gr/microhacks/bevy-web-utils"
license = "Apache-2.0"
[dependencies]
bevy_ecs = "0.11.0"
bevy_input = "0.11.0"
bevy_math = "0.11.0"
bevy_ecs = "0.13.0"
bevy_input = "0.13.0"
bevy_math = "0.13.0"
bevy_window = "0.13.0"
wasm-bindgen = "0.2.83"
serde = "1.0.151"
serde_json = "1.0.91"
\ No newline at end of file
serde = "1.0"
serde_json = "1.0"
\ No newline at end of file
use bevy_ecs::entity::Entity;
use bevy_ecs::event::EventWriter;
use bevy_ecs::query::With;
use bevy_ecs::system::Query;
use bevy_input::touch::{TouchInput, TouchPhase};
use bevy_math::Vec2;
use bevy_window::{PrimaryWindow, Window};
use std::fmt::{Display, Formatter};
#[derive(serde::Deserialize)]
......@@ -39,10 +43,19 @@ fn inner_touch_events() -> Result<impl IntoIterator<Item = InnerTouchInput>, Tou
Ok(touch_events.into_iter())
}
pub fn emit_touch_events(mut events: EventWriter<TouchInput>) {
pub fn emit_touch_events(
windows: Query<Entity, With<PrimaryWindow>>,
mut events: EventWriter<TouchInput>,
) {
let window = match windows.iter().next() {
Some(window) => window,
None => return,
};
if let Ok(inner_events) = inner_touch_events() {
for input in inner_events {
events.send(TouchInput {
window,
phase: input.phase,
position: input.position,
id: input.id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment