From de3d4f63112eb29d4f5d4831e2d3e33fec69001c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Wed, 30 Mar 2016 14:03:36 +0200 Subject: [PATCH] Utilisation de la construction make_shared/make_unique --- include/player.hpp | 2 +- src/block.cpp | 4 ++-- src/player.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/player.hpp b/include/player.hpp index ec9697b..f07e737 100644 --- a/include/player.hpp +++ b/include/player.hpp @@ -13,7 +13,7 @@ protected: /** * Calcule les forces appliquées à l'objet */ - virtual sf::Vector2f getForces(const Manager& manager, const std::vector& objects) const; + virtual sf::Vector2f getForces(const Manager& manager, const std::vector& objects) const; public: Player(float x, float y); diff --git a/src/block.cpp b/src/block.cpp index 3cd792f..6a6fc3f 100644 --- a/src/block.cpp +++ b/src/block.cpp @@ -36,11 +36,11 @@ void Block::draw(Manager& manager) { } std::unique_ptr Block::getAABB() const { - return std::unique_ptr(new sf::FloatRect( + return std::make_unique( getPosition().x - Constants::GRID / 2, getPosition().y - Constants::GRID / 2, Constants::GRID, Constants::GRID - )); + ); } unsigned int Block::getTypeId() const { diff --git a/src/player.cpp b/src/player.cpp index 6835d5f..5a897ea 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -11,7 +11,7 @@ Player::Player(float x, float y) : Object(x, y) { Player::~Player() {} -sf::Vector2f Player::getForces(const Manager& manager, const std::vector& objects) const { +sf::Vector2f Player::getForces(const Manager& manager, const std::vector& objects) const { sf::Vector2f forces = Object::getForces(manager, objects); // déplacement de la balle après appui sur les touches de direction @@ -53,11 +53,11 @@ void Player::draw(Manager& manager) { } std::unique_ptr Player::getAABB() const { - return std::unique_ptr(new sf::FloatRect( + return std::make_unique( getPosition().x - getRadius(), getPosition().y - getRadius(), 2 * getRadius(), 2 * getRadius() - )); + ); } unsigned int Player::getTypeId() const {