Skip to content

Commit

Permalink
Addressed comments from @Bastaclop
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidmt committed Nov 9, 2020
1 parent 49c0dac commit ccdf636
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions testbed/examples/apply_force.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ fn main() {

let process_input = |input: &Input, data: &mut testbed::Data<NoUserData>| match input {
Input::Button(ButtonArgs {
state: _,
state,
button,
scancode: _,
}) => {
match button {
Keyboard(Key::Z) => {
match (state, button) {
(ButtonState::Press, Keyboard(Key::Z)) => {
let mut body = data.world.body_mut(body);
let f = body.world_vector(&b2::Vec2 { x: 0., y: -200. });
let p = body.world_point(&b2::Vec2 { x: 0., y: 2. });
body.apply_force(&f, &p, true);
}
Keyboard(Key::Q) => {
(ButtonState::Press, Keyboard(Key::Q)) => {
data.world.body_mut(body).apply_torque(50., true);
}
Keyboard(Key::D) => {
(ButtonState::Press, Keyboard(Key::D)) => {
data.world.body_mut(body).apply_torque(-50., true);
}
_ => {}
Expand Down
8 changes: 4 additions & 4 deletions testbed/examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ fn main() {
};

if let Input::Button(ButtonArgs {
state: _,
state,
button,
scancode: _,
}) = input
{
match button {
Button::Keyboard(Key::A) => create_body(&cube_shape),
Button::Keyboard(Key::Z) => create_body(&circle_shape),
match (state, button) {
(ButtonState::Press, Button::Keyboard(Key::A)) => create_body(&cube_shape),
(ButtonState::Press, Button::Keyboard(Key::Z)) => create_body(&circle_shape),
_ => {}
}
}
Expand Down

0 comments on commit ccdf636

Please sign in to comment.