Constructeurs virtuels

This commit is contained in:
Mattéo Delabre 2016-03-28 20:02:23 +02:00
parent 6f0ff5131e
commit 62013124ab
8 changed files with 18 additions and 2 deletions

View File

@ -10,6 +10,7 @@ private:
public:
Block(float x, float y);
virtual ~Block();
/**
* Dessin du bloc dans la fenêtre donnée

View File

@ -32,6 +32,7 @@ protected:
public:
Object(float x, float y);
virtual ~Object();
/**
* Dessine l'objet dans la fenêtre donnée

View File

@ -17,6 +17,7 @@ protected:
public:
Player(float x, float y);
virtual ~Player();
/**
* Dessine la balle dans la fenêtre donnée

View File

@ -12,6 +12,10 @@ Block::Block(float x, float y) : Object(x, y) {
sprite.setOrigin(sf::Vector2f(Constants::GRID / 2, Constants::GRID / 2));
}
Block::~Block() {
Object::~Object();
}
void Block::draw(Manager& manager) {
Object::draw(manager);

View File

@ -1,10 +1,9 @@
#include "game.hpp"
#include "constants.hpp"
#include "player.hpp"
#include <cmath>
#include <queue>
#include "player.hpp"
Game::Game() : accumulator(0.f) {
if (!music.openFromFile("./res/music_lvl1.wav")) {
// erreur
@ -18,6 +17,7 @@ Game::Game() : accumulator(0.f) {
}
Game::~Game() {
View::~View();
clear();
}

View File

@ -15,6 +15,8 @@ Object::Object(float x, float y) :
dynamic_friction(0.2f),
layer(Constants::DEFAULT_LAYER) {}
Object::~Object() {}
sf::Vector2f Object::getForces(
const Manager& manager, const std::vector<Object*>& objects
) const {

View File

@ -9,6 +9,10 @@ Player::Player(float x, float y) : Object(x, y) {
sprite.setOrigin(sf::Vector2f(getRadius(), getRadius()));
}
Player::~Player() {
Object::~Object();
}
sf::Vector2f Player::getForces(const Manager& manager, const std::vector<Object*>& objects) const {
sf::Vector2f forces = Object::getForces(manager, objects);

3
src/view.cpp Normal file
View File

@ -0,0 +1,3 @@
#include "view.hpp"
View::~View() {}