Skip to content

Commit

Permalink
Center 0,0,0 and more radius sliders
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpulvis committed Sep 24, 2024
1 parent 505c109 commit 774714c
Showing 4 changed files with 19 additions and 8 deletions.
5 changes: 1 addition & 4 deletions galos_map/src/camera.rs
Original file line number Diff line number Diff line change
@@ -37,10 +37,7 @@ pub fn spawn_camera(mut commands: Commands, spyglass: Res<Spyglass>) {
pitch: Some(0.),
yaw: Some(0.),
radius: Some(spyglass.radius * 3.),

// Achenar, home of the Empire!
focus: Vec3::new(67.5, -119.46875, 24.84375),

focus: Vec3::splat(0.),
zoom_sensitivity: 1.0,
..default()
},
2 changes: 1 addition & 1 deletion galos_map/src/systems/despawn.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ use bevy::prelude::*;

pub fn plugin(app: &mut App) {
app.add_event::<Despawn>();
app.add_systems(Update, despawn);
app.add_systems(Update, despawn.after(super::spawn::spawn));
}

#[derive(Event)]
2 changes: 1 addition & 1 deletion galos_map/src/systems/mod.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ use galos_db::systems::System as DbSystem;

pub fn plugin(app: &mut App) {
app.insert_resource(Spyglass {
radius: 50.,
radius: 10.,
fetch: true,
disabled: false,
lock_camera: false,
18 changes: 16 additions & 2 deletions galos_map/src/ui.rs
Original file line number Diff line number Diff line change
@@ -98,13 +98,27 @@ pub fn panels(
// size, no?
ui.set_width(150.);

ui.label("Spyglass Radius");
ui.group(|ui| {
ui.label("Spyglass Radius");
ui.label("Linear (1-50)");
ui.add(
egui::Slider::new(&mut spyglass.radius, 1.0..=50.)
.step_by(0.1)
.drag_value_speed(0.2),
);
ui.label("Exponential (10-500)");
ui.add(
egui::Slider::new(&mut spyglass.radius, 10.0..=500.)
.step_by(1.)
.drag_value_speed(0.2),
);
ui.label("Exponential (10-1.1e5)");
ui.add(
// Width of the galaxy is 105,700 Ly.
egui::Slider::new(&mut spyglass.radius, 10.0..=1.1e5)
.logarithmic(true)
.drag_value_speed(0.1),
.step_by(10.)
.drag_value_speed(0.5),
);
ui.add_space(2.);
ui.checkbox(&mut spyglass.lock_camera, "Lock Camera");

0 comments on commit 774714c

Please sign in to comment.