Skip to content

Commit

Permalink
update action
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-tennert committed Oct 18, 2023
1 parent 3e1a119 commit f8ef7a2
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,32 @@ jobs:
- uses: olegtarasov/[email protected]
id: get_version
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'

- name: Build
run: |
cargo build --release --target x86_64-pc-windows-msvc
- name: Build Horizon Ui
run: |
.\horizon-ui\gradlew obfuscate
- name: Prepare package
run: |
mkdir windows
cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/
cp -r assets windows/
cp .\horizon-ui\build\compose\jars\horizon-ui-windows-x64-1.0.0.min.jar windows/horizon-ui.jar
- name: Package as a zip
run: |
Expand Down
2 changes: 1 addition & 1 deletion assets/bodies.sim

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn main() {
..default()
})
)
.add_plugins(WorldInspectorPlugin::new())
// .add_plugins(WorldInspectorPlugin::new())
// .add_plugins(DefaultPickingPlugins)
.add_plugins(LockOnPlugin)
.add_plugins(SerializationPlugin)
Expand Down
4 changes: 2 additions & 2 deletions src/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ fn rotate_bodies(
let rotation_duration = rotation_speed.0 * 60.0;
let rotations_per_day = DAY_IN_SECONDS / (rotation_duration as f32);

transform.rotate_axis(axis.axis.unwrap(), 2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier));
// transform.rotate_z(2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier));
// transform.rotate_axis(axis.axis.unwrap(), 2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier));
transform.rotate_z(2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier));

}
}
Expand Down
28 changes: 14 additions & 14 deletions src/selection.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
use bevy::app::{App, Plugin, Update};
use bevy::prelude::{in_state, Query, Transform, Resource, Entity, With, ResMut, IntoSystemConfigs, Vec3};
use bevy::prelude::{in_state, Query, Transform, Resource, Entity, With, ResMut, IntoSystemConfigs};
use crate::SimState;
use crate::body::Mass;
use crate::pan_orbit::lib::PanOrbitCamera;
use crate::physics::update_position;
use crate::body::{Mass, Star};

pub struct SelectionPlugin;

impl Plugin for SelectionPlugin {

fn build(&self, app: &mut App) {
app
.init_resource::<SelectedEntity>();
// .add_systems(Update, (apply_camera_to_selection.after(update_position)).run_if(in_state(SimState::Simulation)));
.init_resource::<SelectedEntity>()
.add_systems(Update, (apply_camera_to_selection).run_if(in_state(SimState::Simulation)));
}

}
Expand All @@ -21,17 +19,19 @@ impl Plugin for SelectionPlugin {
pub struct SelectedEntity(pub Option<Entity>);

pub fn apply_camera_to_selection(
mut camera: Query<&mut PanOrbitCamera>,
bodies: Query<(&Transform, With<Mass>)>,
bodies: Query<(Entity, &Transform, With<Mass>, Option<&Star>)>,
mut selected_entity: ResMut<SelectedEntity>
) {
let mut camera = camera.single_mut();
if let Some(entity) = selected_entity.0 {
if let Ok((transform, _)) = bodies.get(entity) {
// camera.target_focus = Vec3::ZERO;
// camera.force_update = true;
} else {
selected_entity.0 = None;
if let Err(_) = bodies.get(entity) {
selected_entity.0 = None;
}
} else {
println!("hi??");
if let Some((entity, _, _, _)) = bodies.iter().find(|(_, _, _, maybe_star)| {
maybe_star.is_some()
}) {
selected_entity.0 = Some(entity);
}
}
}
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct UIPlugin;
impl Plugin for UIPlugin {
fn build(&self, app: &mut App) {
app
//.add_plugins(EguiPlugin)
.add_plugins(EguiPlugin)
.init_resource::<UiState>()
.register_type::<SimTime>()
.init_resource::<SimTime>()
Expand Down

0 comments on commit f8ef7a2

Please sign in to comment.