mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
parent
dbf0d7071e
commit
9d5837769c
2 changed files with 7 additions and 2 deletions
|
@ -13,6 +13,7 @@ keywords = ["bevy", "accessibility", "a11y"]
|
|||
bevy_app = { path = "../bevy_app", 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_reflect = { path = "../bevy_reflect", version = "0.15.0-dev" }
|
||||
|
||||
accesskit = "0.16"
|
||||
|
||||
|
|
|
@ -17,10 +17,11 @@ use accesskit::NodeBuilder;
|
|||
use bevy_app::Plugin;
|
||||
use bevy_derive::{Deref, DerefMut};
|
||||
use bevy_ecs::{
|
||||
prelude::{Component, Entity, Event},
|
||||
prelude::{Component, Entity, Event, ReflectResource},
|
||||
schedule::SystemSet,
|
||||
system::Resource,
|
||||
};
|
||||
use bevy_reflect::Reflect;
|
||||
|
||||
/// Wrapper struct for [`accesskit::ActionRequest`]. Required to allow it to be used as an `Event`.
|
||||
#[derive(Event, Deref, DerefMut)]
|
||||
|
@ -92,7 +93,8 @@ impl From<NodeBuilder> for AccessibilityNode {
|
|||
}
|
||||
|
||||
/// 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>);
|
||||
|
||||
/// Set enum for the systems relating to accessibility
|
||||
|
@ -108,6 +110,8 @@ pub struct AccessibilityPlugin;
|
|||
|
||||
impl Plugin for AccessibilityPlugin {
|
||||
fn build(&self, app: &mut bevy_app::App) {
|
||||
app.register_type::<Focus>();
|
||||
|
||||
app.init_resource::<AccessibilityRequested>()
|
||||
.init_resource::<ManageAccessibilityUpdates>()
|
||||
.init_resource::<Focus>()
|
||||
|
|
Loading…
Reference in a new issue