From 624b377e723d4c65999b85da8a4d3e6298e5b39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Sat, 12 Mar 2016 23:15:03 +0100 Subject: [PATCH] Nouvelles textures de test pour mieux voir les contours --- include/ball.hpp | 1 - include/block.hpp | 1 - res/ball.png | Bin 0 -> 212 bytes res/balle.png | Bin 1589 -> 0 bytes res/balle.svg | 84733 -------------------------------------------- res/block.png | Bin 0 -> 155 bytes src/ball.cpp | 4 +- src/block.cpp | 8 +- src/main.cpp | 9 + 9 files changed, 15 insertions(+), 84741 deletions(-) create mode 100644 res/ball.png delete mode 100644 res/balle.png delete mode 100644 res/balle.svg create mode 100644 res/block.png 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 0000000000000000000000000000000000000000..86d0bce5fc9b21aecf8e8e4285076d8869f0e73e GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAf3?x51|2hvyaR&H=xH2%L|6joH_3Kx^Cf<>&pIsnMaI? zNw{={8c@i^)5S4_<9c#J0#9i|LV^G{Z(>5i86MW68_U|-*bFwbHhFj|NHVDgH>PMf xYs3YKtPyhB)a2VRp=Y7OdxBr>jKSV@O1TaS?83{1OUxqIdK30 literal 0 HcmV?d00001 diff --git a/res/balle.png b/res/balle.png deleted file mode 100644 index 887adf70b8de5c39c3fab4f4c7af2b137fa62f3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1589 zcmV-52Fm$~P)K5dga{((ts`!b0EoAwE9gKZ21WgR1=ymVp=tpcU0+AeKEnwG># z{E|A3kKcWq<8#hFB;LAF0hjcAc|P2~`+1&A_w@*TzM{Ybz#*U)2ygBufdnuCya_CS zL7mU22Y4Q60?rpK3pl>nz-J`fVDB*S65y3(iJ`CVCKB%FXWuzYyf==ZY9tFK&V9PX z8-G5*U&hC=EDN9vJPwS19^gm7vw*lQelv%U9w4%Hn1^D0w7Kedv;Zzq!4(W3gd*Vf za`o&acRlsCSO|2ls`5JYj`zI_aRZ7B1s;~)jHl8%wp6rT+vyt`=Jn&RV%zoz@Pf#O&!ztUK1O1_EGfAY6z@1-OPNHz-jB}(uHfJQVOQOhvsSywNl~W?PD$D+$RJ5 z01w^sC>@TUr%(Noh_{=XN1?9ySh;+W*sWWru2=A?TUbjakqn#u-BE@Hw&Ck~lz;{< z%b_WGaA?q>b+rI-5eNbV{oQ!o3VvxTfLo=iP^xFXZ{_@mDywb340&oj9U}B-B`MdQcPrM{6VU6@lIDJFrwY3(E^s9Eon* z#r#T!?wh)~ypn1G=0)Hnz}b&KWbR6Wx!FZTSw(Xz?G?gAWIHjm%z?w6pyH( z2q0M&0uFAU2VW#adoY48md=shf7o#gF_6R?p9M>ntjKLFTBq9*}6n_Zz$E^zjfPmm;;YOzkKYErWt zDpiwkd^S)=W_rh;9=lpzJvn6uK<%T7y5q$LN_XOqtL%zVgCDV niSfVRmU%X=;!QT*@P_&~w>Dl-l+6d$00000NkvXXu0mjf7Kqev 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 0000000000000000000000000000000000000000..6a5827a377600de31dd3609a6d68c9545b7b8e04 GIT binary patch literal 155 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnL3?x0byx0z;*aCb)T)Pi@ef|1%j{MbYKoQ0y zZ+91l4pvzYAcwQSBeIx*f$sP)OR-#W95A vda?iuQ`@iq|NlF7{13SH-%;TjBMZZmX?bBin$}N&${0Ld{an^LB{Ts5=rt`m literal 0 HcmV?d00001 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;