Merge branch 'master' of https://github.com/matteodelabre/projet-cmi
This commit is contained in:
commit
11ecc85ea2
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ CC=g++
|
||||||
CFLAGS=-Wall -std=c++11
|
CFLAGS=-Wall -std=c++11
|
||||||
TARGET=ptf
|
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) \
|
$(CC) $(CFLAGS) -o build/$(TARGET) \
|
||||||
build/main.o build/object.o build/physics_object.o build/block.o \
|
build/main.o build/object.o build/physics_object.o build/block.o \
|
||||||
build/ball.o build/engine.o \
|
build/ball.o build/engine.o \
|
||||||
|
|
|
@ -86,4 +86,6 @@ void Engine::draw() {
|
||||||
display_queue.top()->draw(window);
|
display_queue.top()->draw(window);
|
||||||
display_queue.pop();
|
display_queue.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.display();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "physics_object.hpp"
|
#include "physics_object.hpp"
|
||||||
|
|
||||||
void PhysicsObject::update(State state) {
|
void PhysicsObject::update(State state) {
|
||||||
sf::Vector2f forces = getForces(state);
|
sf::Vector2f acceleration = getForces(state) / mass;
|
||||||
|
velocity += acceleration * state.delta;
|
||||||
// TODO: intégrer le vecteur force dans la vitesse puis la position
|
position += velocity * state.delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
sf::Vector2f PhysicsObject::getVelocity() {
|
sf::Vector2f PhysicsObject::getVelocity() {
|
||||||
|
|
Loading…
Reference in New Issue