mise en place des fonctions de dessins des balles et des blocs.
This commit is contained in:
parent
0f37d49c6c
commit
01bcf9ed66
3
ball.cpp
3
ball.cpp
|
@ -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) {
|
||||
|
|
7
ball.hpp
7
ball.hpp
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
BIN
build/ball.o
BIN
build/ball.o
Binary file not shown.
BIN
build/engine.o
BIN
build/engine.o
Binary file not shown.
BIN
build/main.o
BIN
build/main.o
Binary file not shown.
BIN
build/object.o
BIN
build/object.o
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue