bevy-expedition-demo/src/lib.rs
2ndbeam ae7bfd7c27 feat: Added input system
- Added input plugin to manage controls config
- Added tests for casting InputMap to InputAsset and backwards
2026-03-03 09:26:52 +03:00

44 lines
974 B
Rust

pub mod player;
pub mod layout;
pub mod input;
#[cfg(test)]
mod tests;
use bevy::prelude::*;
pub struct ExpeditionPlugin;
pub enum InputActions {
MoveLeft,
MoveRight,
ToggleInventory,
Interact,
}
fn camera_bundle() -> impl Bundle {
(
Camera2d,
Camera {
clear_color: ClearColorConfig::Custom(Color::hsl(0.02, 0.67, 0.65)),
..default()
},
Projection::Orthographic(OrthographicProjection {
scaling_mode: bevy::camera::ScalingMode::FixedVertical {
viewport_height: 384.,
},
scale: 1.,
..OrthographicProjection::default_2d()
}),
)
}
fn setup_global(mut commands: Commands) {
commands.spawn(camera_bundle());
}
impl Plugin for ExpeditionPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Startup, (player::setup_player, setup_global))
.add_systems(Update, player::handle_input);
}
}