This commit is contained in:
Rémi Cérès 2016-03-10 21:49:33 +01:00
commit 11ecc85ea2
3 changed files with 6 additions and 4 deletions

View File

@ -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 \

View File

@ -86,4 +86,6 @@ void Engine::draw() {
display_queue.top()->draw(window);
display_queue.pop();
}
window.display();
}

View File

@ -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() {