|
|
|
@ -126,13 +126,11 @@ int main() { |
|
|
|
|
break; |
|
|
|
|
case sf::Event::KeyPressed: |
|
|
|
|
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) { |
|
|
|
|
shape.move(-20, 0); |
|
|
|
|
b2Vec2 force(-200, 1000); |
|
|
|
|
box.body->ApplyForceToCenter(force, true); |
|
|
|
|
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) { |
|
|
|
|
shape.move(20, 0); |
|
|
|
|
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) { |
|
|
|
|
shape.move(0, -20); |
|
|
|
|
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) { |
|
|
|
|
shape.move(0, 20); |
|
|
|
|
b2Vec2 force(200, 1000); |
|
|
|
|
box.body->ApplyForceToCenter(force, true); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case sf::Event::MouseButtonPressed: |
|
|
|
|