generated from tipragot/rust
Add a camera system #69
|
@ -16,11 +16,11 @@ struct CameraSpeedScale(f32);
|
|||
|
||||
/// The minimum scale of the camera.
|
||||
#[derive(Resource)]
|
||||
struct MinScale(f32);
|
||||
struct MinimumScale(f32);
|
||||
CoCo_Sol marked this conversation as resolved
Outdated
|
||||
|
||||
/// The maximum scale of the camera.
|
||||
#[derive(Resource)]
|
||||
struct MaxScale(f32);
|
||||
struct MaximumScale(f32);
|
||||
|
||||
/// Key settings for camera movement.
|
||||
#[derive(Resource)]
|
||||
|
@ -61,8 +61,8 @@ fn init_camera(mut commands: Commands) {
|
|||
/// - [KeysMovementSettings]: The key settings for camera movement.
|
||||
/// - [CameraSpeedMouvement]: The speed of camera movement.
|
||||
/// - [CameraSpeedScale]: The speed of camera scaling.
|
||||
/// - [MinScale]: The minimum scale of the camera.
|
||||
/// - [MaxScale]: The maximum scale of the camera.
|
||||
/// - [MinimumScale]: The minimum scale of the camera.
|
||||
/// - [MaximumScale]: The maximum scale of the camera.
|
||||
fn init_resources(mut commands: Commands) {
|
||||
commands.insert_resource(KeysMovementSettings {
|
||||
up: KeyCode::Z,
|
||||
|
@ -73,8 +73,8 @@ fn init_resources(mut commands: Commands) {
|
|||
|
||||
commands.insert_resource(CameraSpeedMouvement(10.0));
|
||||
commands.insert_resource(CameraSpeedScale(0.1));
|
||||
commands.insert_resource(MinScale(0.1));
|
||||
commands.insert_resource(MaxScale(10.0));
|
||||
commands.insert_resource(MinimumScale(0.1));
|
||||
commands.insert_resource(MaximumScale(10.0));
|
||||
}
|
||||
|
||||
/// Moves the camera with keyboard input.
|
||||
|
@ -104,8 +104,8 @@ fn movement_system(
|
|||
fn scale_system(
|
||||
mut scroll_event: EventReader<MouseWheel>,
|
||||
mut query: Query<&mut OrthographicProjection, With<Camera>>,
|
||||
min_scale: Res<MinScale>,
|
||||
max_scale: Res<MaxScale>,
|
||||
min_scale: Res<MinimumScale>,
|
||||
max_scale: Res<MaximumScale>,
|
||||
scale_speed: Res<CameraSpeedScale>,
|
||||
) {
|
||||
for ev in scroll_event.read() {
|
||||
|
|
Loading…
Reference in a new issue
No abreviations