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"
|
#include "ball.hpp"
|
||||||
|
|
||||||
void Ball::draw(sf::RenderWindow& window) {
|
void Ball::draw(sf::RenderWindow& window) {
|
||||||
// TODO: implémenter cette fonction
|
shape.setPosition(position);
|
||||||
|
window.draw(shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
sf::Vector2f Ball::getForces(State state) {
|
sf::Vector2f Ball::getForces(State state) {
|
||||||
|
|
7
ball.hpp
7
ball.hpp
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
class Ball : public PhysicsObject {
|
class Ball : public PhysicsObject {
|
||||||
protected:
|
protected:
|
||||||
|
sf::CircleShape shape;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calcule les forces appliquées à l'objet
|
* Calcule les forces appliquées à l'objet
|
||||||
*/
|
*/
|
||||||
|
@ -17,8 +19,9 @@ protected:
|
||||||
static constexpr float MOVE = 10;
|
static constexpr float MOVE = 10;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// utilise le constructeur de PhysicsObject
|
Ball(float x, float y) : PhysicsObject(x, y), shape(10 * mass) {
|
||||||
using PhysicsObject::PhysicsObject;
|
shape.setFillColor(sf::Color(150,255,20));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dessine la balle dans la fenêtre donnée
|
* Dessine la balle dans la fenêtre donnée
|
||||||
|
|
|
@ -7,7 +7,14 @@
|
||||||
#include "state.hpp"
|
#include "state.hpp"
|
||||||
|
|
||||||
class Block : public Object {
|
class Block : public Object {
|
||||||
|
protected:
|
||||||
|
sf::CircleShape shape;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Block(float x, float y) : Object(x,y), shape(80,4) {
|
||||||
|
shape.setFillColor(sf::Color(0,0,0));
|
||||||
|
}
|
||||||
|
|
||||||
// utilise le constructeur de Object
|
// utilise le constructeur de Object
|
||||||
using Object::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