diff --git a/include/ball.hpp b/include/ball.hpp index 6f11565..28b0478 100644 --- a/include/ball.hpp +++ b/include/ball.hpp @@ -22,7 +22,6 @@ protected: public: Ball(float x, float y) : PhysicsObject(x, y), shape(10 * mass) { shape.setOrigin(sf::Vector2f(10 * mass, 10 * mass)); - shape.setFillColor(sf::Color(255, 245, 131)); } /** diff --git a/include/block.hpp b/include/block.hpp index f052f62..669b644 100644 --- a/include/block.hpp +++ b/include/block.hpp @@ -16,7 +16,6 @@ public: Block(float x, float y) : Object(x, y), shape(sf::Vector2f(Block::GRID, Block::GRID)) { shape.setOrigin(sf::Vector2f(Block::GRID / 2, Block::GRID / 2)); - shape.setFillColor(sf::Color(0, 0, 0)); } /** diff --git a/res/ball.png b/res/ball.png new file mode 100644 index 0000000..86d0bce Binary files /dev/null and b/res/ball.png differ diff --git a/res/balle.png b/res/balle.png deleted file mode 100644 index 887adf7..0000000 Binary files a/res/balle.png and /dev/null differ diff --git a/res/balle.svg b/res/balle.svg deleted file mode 100644 index 7dad9ff..0000000 --- a/res/balle.svg +++ /dev/null @@ -1,84733 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/res/block.png b/res/block.png new file mode 100644 index 0000000..6a5827a Binary files /dev/null and b/res/block.png differ diff --git a/src/ball.cpp b/src/ball.cpp index 04ecb0b..cd0a9b2 100644 --- a/src/ball.cpp +++ b/src/ball.cpp @@ -2,7 +2,7 @@ void Ball::draw(sf::RenderWindow& window) { // chargement de la texture de test - if (!texture.loadFromFile("./res/texture_test.jpeg")) { + if (!texture.loadFromFile("./res/ball.png")) { // erreur } @@ -39,7 +39,7 @@ sf::Vector2f Ball::getForces(State state) { // la norme de ce vecteur est la distance entre les objets float distanceSquared = attraction.x * attraction.x + attraction.y * attraction.y; - + // éviter la division par zéro if (distanceSquared == 0) { continue; diff --git a/src/block.cpp b/src/block.cpp index 137f163..6410f9c 100644 --- a/src/block.cpp +++ b/src/block.cpp @@ -2,18 +2,18 @@ void Block::draw(sf::RenderWindow& window) { // chargement de la texture de test - if (!texture.loadFromFile("./res/texture_test.jpeg")) { + if (!texture.loadFromFile("./res/block.png")) { // erreur } shape.setTexture(&texture); if (charge > 0) { - shape.setFillColor(sf::Color(0, 0, 255)); + shape.setFillColor(sf::Color(180, 180, 255)); } else if (charge < 0) { - shape.setFillColor(sf::Color(255, 0, 0)); + shape.setFillColor(sf::Color(255, 180, 180)); } else { - shape.setFillColor(sf::Color(75, 75, 75)); + shape.setFillColor(sf::Color::White); } shape.setPosition(position); diff --git a/src/main.cpp b/src/main.cpp index 5299512..fcf0c58 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,10 +14,15 @@ int main() { Block block3(4 * Block::GRID, 7 * Block::GRID); Block block4(5 * Block::GRID, 7 * Block::GRID); Block block5(6 * Block::GRID, 7 * Block::GRID); + Block block6(7 * Block::GRID, 7 * Block::GRID); + Block block7(8 * Block::GRID, 7 * Block::GRID); + Block block8(9 * Block::GRID, 7 * Block::GRID); + Block block9(10 * Block::GRID, 7 * Block::GRID); ball1.setCharge(2); ball2.setCharge(-2); block3.setCharge(10); + block9.setCharge(-10); engine.addObject(ball1); engine.addObject(ball2); @@ -26,6 +31,10 @@ int main() { engine.addObject(block3); engine.addObject(block4); engine.addObject(block5); + engine.addObject(block6); + engine.addObject(block7); + engine.addObject(block8); + engine.addObject(block9); engine.start(); return 0;