Skip to content

Commit

Permalink
added divider
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhan45 committed Mar 6, 2024
1 parent 2495b02 commit 3c85d5f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Binary file modified docs/simple_gravity_bg.wasm
Binary file not shown.
12 changes: 5 additions & 7 deletions non_builtin_rhai_scripts/springs.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const SPRING_CONSTANT = 0.001;
const DAMPING_FACTOR = 0.999;
set_dt(1.0);

set_g(0.0); # disables gravity
set_g(0.0);

fn apply_spring_force(body) {
draw_body_spring(body);
Expand Down Expand Up @@ -43,19 +43,17 @@ let update = |ids, bodies| {
let body_kinetic_energy = calculate_kinetic_energy(body);
let body_potential_energy = calculate_potential_energy(body);

if body == ids[0] {
add_point("Kinetic", body_kinetic_energy);
add_point("Potential", body_potential_energy);
add_point("Total", body_kinetic_energy + body_potential_energy);
}

// add the body's energy to the total
total_kinetic_energy += body_kinetic_energy;
total_potential_energy += body_potential_energy;
}

let total_energy =
total_kinetic_energy + total_potential_energy;

add_point("Kinetic", total_kinetic_energy);
add_point("Potential", total_potential_energy);
add_point("Total", total_kinetic_energy + total_potential_energy);
};

fn draw_spring(start, end, width, thickness, coils) {
Expand Down
1 change: 1 addition & 0 deletions src/ui/code_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub fn code_editor_sys(
ace_shown = false;
}

ui.add(egui::widgets::Separator::default().horizontal());
ui.horizontal(|ui| {
if ui.button("Run").clicked() {
code_editor.output = None;
Expand Down

0 comments on commit 3c85d5f

Please sign in to comment.