diff --git a/Makefile b/Makefile index dd249c9..a45e723 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC=g++ CFLAGS=-Wall -std=c++11 TARGET=ptf -$(TARGET): build/main.o build/object.o build/physics_object.o build/block.o build/ball.o build/engine.o +$(TARGET): build/main.o build/object.o build/physics_object.o build/block.o build/ball.o build/engine.o $(CC) $(CFLAGS) -o build/$(TARGET) \ build/main.o build/object.o build/physics_object.o build/block.o \ build/ball.o build/engine.o \ diff --git a/engine.cpp b/engine.cpp index 71a78aa..ad06a1f 100644 --- a/engine.cpp +++ b/engine.cpp @@ -86,4 +86,6 @@ void Engine::draw() { display_queue.top()->draw(window); display_queue.pop(); } + + window.display(); } diff --git a/physics_object.cpp b/physics_object.cpp index 4d6217b..280da42 100644 --- a/physics_object.cpp +++ b/physics_object.cpp @@ -1,9 +1,9 @@ #include "physics_object.hpp" void PhysicsObject::update(State state) { - sf::Vector2f forces = getForces(state); - - // TODO: intégrer le vecteur force dans la vitesse puis la position + sf::Vector2f acceleration = getForces(state) / mass; + velocity += acceleration * state.delta; + position += velocity * state.delta; } sf::Vector2f PhysicsObject::getVelocity() {