mise en place des fonctions de dessins des balles et des blocs.

This commit is contained in:
Rémi Cérès 2016-03-10 21:47:19 +01:00
parent 0f37d49c6c
commit 01bcf9ed66
9 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,8 @@
#include "ball.hpp"
void Ball::draw(sf::RenderWindow& window) {
// TODO: implémenter cette fonction
shape.setPosition(position);
window.draw(shape);
}
sf::Vector2f Ball::getForces(State state) {

View File

@ -8,6 +8,8 @@
class Ball : public PhysicsObject {
protected:
sf::CircleShape shape;
/**
* Calcule les forces appliquées à l'objet
*/
@ -17,8 +19,9 @@ protected:
static constexpr float MOVE = 10;
public:
// utilise le constructeur de PhysicsObject
using PhysicsObject::PhysicsObject;
Ball(float x, float y) : PhysicsObject(x, y), shape(10 * mass) {
shape.setFillColor(sf::Color(150,255,20));
}
/**
* Dessine la balle dans la fenêtre donnée

View File

@ -7,7 +7,14 @@
#include "state.hpp"
class Block : public Object {
protected:
sf::CircleShape shape;
public:
Block(float x, float y) : Object(x,y), shape(80,4) {
shape.setFillColor(sf::Color(0,0,0));
}
// utilise le constructeur de Object
using Object::Object;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
build/ptf

Binary file not shown.