Affichage des blocs aimantés en couleur

This commit is contained in:
Mattéo Delabre 2016-03-11 16:15:27 +01:00
parent f0632db66f
commit 41d5c3696c
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,14 @@
#include "block.hpp" #include "block.hpp"
void Block::draw(sf::RenderWindow& window) { 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); shape.setPosition(position);
window.draw(shape); window.draw(shape);
} }