From 41d5c3696cfca0d67220527ac24d4a8c1eb32ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Fri, 11 Mar 2016 16:15:27 +0100 Subject: [PATCH] =?UTF-8?q?Affichage=20des=20blocs=20aimant=C3=A9s=20en=20?= =?UTF-8?q?couleur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- block.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block.cpp b/block.cpp index 2ee62dd..5ef9ee1 100644 --- a/block.cpp +++ b/block.cpp @@ -1,6 +1,14 @@ #include "block.hpp" void Block::draw(sf::RenderWindow& window) { + if (charge > 0) { + shape.setFillColor(sf::Color(0, 0, 255)); + } else if (charge < 0) { + shape.setFillColor(sf::Color(255, 0, 0)); + } else { + shape.setFillColor(sf::Color(0, 0, 0)); + } + shape.setPosition(position); window.draw(shape); }