use std::collections::HashMap;
use std::hash::Hash;
use repame_sim::bevy_ecs::prelude::*;
use repose_core::input::GamepadAxis;
mod aim;
mod binding;
mod haptics;
mod held;
mod keymap;
mod map;
mod motion;
mod remap;
mod snapshot;
mod state;
pub use aim::{AimTracker, StagedClick};
pub use binding::Binding;
pub use haptics::{HapticBus, HapticEffect, HapticSink};
pub use held::reconcile_held;
pub use keymap::{
Keymap, KeymapCapture, KeymapDevice, KeymapEntry, KeymapRow, chord_for_physical,
decode_keymap_entry, encode_keymap_entry, glyph_for_physical,
};
pub use map::ActionMap;
pub use motion::{GRAVITY, MotionSample, MotionSnapshot, MotionSource, MotionTracker, SensorKind};
pub use remap::RemapSession;
pub use snapshot::{GamepadState, MouseState, TouchContact, apply_stick, dead_zone};
pub use state::ActionState;
pub trait ActionLike: Clone + Eq + Hash + Send + Sync + 'static {}
impl<T: Clone + Eq + Hash + Send + Sync + 'static> ActionLike for T {}
pub fn init_state<A: ActionLike + std::fmt::Debug>(sim: &mut repame_sim::Sim, map: ActionMap<A>) {
sim.world.insert_resource(ActionState::new(map));
}
pub fn end_tick_system<A: ActionLike + std::fmt::Debug>(mut state: ResMut<ActionState<A>>) {
state.end_tick();
}
pub fn stick_pair(state_axes: &HashMap<GamepadAxis, f32>) -> (f32, f32) {
let x = state_axes
.get(&GamepadAxis::LeftStickX)
.copied()
.unwrap_or(0.0);
let y = state_axes
.get(&GamepadAxis::LeftStickY)
.copied()
.unwrap_or(0.0);
(x, y)
}
pub use repose_core::input::PointerButton as MouseButton;
pub use repose_core::input::{GamepadAxis as Axis, GamepadButton as PadButton};
pub use repose_core::shortcuts::KeyChord as Chord;