parent
dbf0d7071e
commit
9d5837769c
@ -13,6 +13,7 @@ keywords = ["bevy", "accessibility", "a11y"]
|
|||||||
bevy_app = { path = "../bevy_app", version = "0.15.0-dev" }
|
bevy_app = { path = "../bevy_app", version = "0.15.0-dev" }
|
||||||
bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
|
bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
|
||||||
bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" }
|
bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" }
|
||||||
|
bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev" }
|
||||||
|
|
||||||
accesskit = "0.16"
|
accesskit = "0.16"
|
||||||
|
|
||||||
|
@ -17,10 +17,11 @@ use accesskit::NodeBuilder;
|
|||||||
use bevy_app::Plugin;
|
use bevy_app::Plugin;
|
||||||
use bevy_derive::{Deref, DerefMut};
|
use bevy_derive::{Deref, DerefMut};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
prelude::{Component, Entity, Event},
|
prelude::{Component, Entity, Event, ReflectResource},
|
||||||
schedule::SystemSet,
|
schedule::SystemSet,
|
||||||
system::Resource,
|
system::Resource,
|
||||||
};
|
};
|
||||||
|
use bevy_reflect::Reflect;
|
||||||
|
|
||||||
/// Wrapper struct for [`accesskit::ActionRequest`]. Required to allow it to be used as an `Event`.
|
/// Wrapper struct for [`accesskit::ActionRequest`]. Required to allow it to be used as an `Event`.
|
||||||
#[derive(Event, Deref, DerefMut)]
|
#[derive(Event, Deref, DerefMut)]
|
||||||
@ -92,7 +93,8 @@ impl From<NodeBuilder> for AccessibilityNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Resource representing which entity has keyboard focus, if any.
|
/// Resource representing which entity has keyboard focus, if any.
|
||||||
#[derive(Resource, Default, Deref, DerefMut)]
|
#[derive(Resource, Default, Deref, DerefMut, Reflect)]
|
||||||
|
#[reflect(Resource)]
|
||||||
pub struct Focus(pub Option<Entity>);
|
pub struct Focus(pub Option<Entity>);
|
||||||
|
|
||||||
/// Set enum for the systems relating to accessibility
|
/// Set enum for the systems relating to accessibility
|
||||||
@ -108,6 +110,8 @@ pub struct AccessibilityPlugin;
|
|||||||
|
|
||||||
impl Plugin for AccessibilityPlugin {
|
impl Plugin for AccessibilityPlugin {
|
||||||
fn build(&self, app: &mut bevy_app::App) {
|
fn build(&self, app: &mut bevy_app::App) {
|
||||||
|
app.register_type::<Focus>();
|
||||||
|
|
||||||
app.init_resource::<AccessibilityRequested>()
|
app.init_resource::<AccessibilityRequested>()
|
||||||
.init_resource::<ManageAccessibilityUpdates>()
|
.init_resource::<ManageAccessibilityUpdates>()
|
||||||
.init_resource::<Focus>()
|
.init_resource::<Focus>()
|
||||||
|
Loading…
Reference in New Issue
Block a user