Nouvelles textures de test pour mieux voir les contours
This commit is contained in:
parent
e7aa2c22e7
commit
624b377e72
|
@ -22,7 +22,6 @@ protected:
|
||||||
public:
|
public:
|
||||||
Ball(float x, float y) : PhysicsObject(x, y), shape(10 * mass) {
|
Ball(float x, float y) : PhysicsObject(x, y), shape(10 * mass) {
|
||||||
shape.setOrigin(sf::Vector2f(10 * mass, 10 * mass));
|
shape.setOrigin(sf::Vector2f(10 * mass, 10 * mass));
|
||||||
shape.setFillColor(sf::Color(255, 245, 131));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,6 @@ public:
|
||||||
|
|
||||||
Block(float x, float y) : Object(x, y), shape(sf::Vector2f(Block::GRID, Block::GRID)) {
|
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.setOrigin(sf::Vector2f(Block::GRID / 2, Block::GRID / 2));
|
||||||
shape.setFillColor(sf::Color(0, 0, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 212 B |
BIN
res/balle.png
BIN
res/balle.png
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
84733
res/balle.svg
84733
res/balle.svg
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 6.2 MiB |
Binary file not shown.
After Width: | Height: | Size: 155 B |
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
void Ball::draw(sf::RenderWindow& window) {
|
void Ball::draw(sf::RenderWindow& window) {
|
||||||
// chargement de la texture de test
|
// chargement de la texture de test
|
||||||
if (!texture.loadFromFile("./res/texture_test.jpeg")) {
|
if (!texture.loadFromFile("./res/ball.png")) {
|
||||||
// erreur
|
// erreur
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
void Block::draw(sf::RenderWindow& window) {
|
void Block::draw(sf::RenderWindow& window) {
|
||||||
// chargement de la texture de test
|
// chargement de la texture de test
|
||||||
if (!texture.loadFromFile("./res/texture_test.jpeg")) {
|
if (!texture.loadFromFile("./res/block.png")) {
|
||||||
// erreur
|
// erreur
|
||||||
}
|
}
|
||||||
|
|
||||||
shape.setTexture(&texture);
|
shape.setTexture(&texture);
|
||||||
|
|
||||||
if (charge > 0) {
|
if (charge > 0) {
|
||||||
shape.setFillColor(sf::Color(0, 0, 255));
|
shape.setFillColor(sf::Color(180, 180, 255));
|
||||||
} else if (charge < 0) {
|
} else if (charge < 0) {
|
||||||
shape.setFillColor(sf::Color(255, 0, 0));
|
shape.setFillColor(sf::Color(255, 180, 180));
|
||||||
} else {
|
} else {
|
||||||
shape.setFillColor(sf::Color(75, 75, 75));
|
shape.setFillColor(sf::Color::White);
|
||||||
}
|
}
|
||||||
|
|
||||||
shape.setPosition(position);
|
shape.setPosition(position);
|
||||||
|
|
|
@ -14,10 +14,15 @@ int main() {
|
||||||
Block block3(4 * Block::GRID, 7 * Block::GRID);
|
Block block3(4 * Block::GRID, 7 * Block::GRID);
|
||||||
Block block4(5 * Block::GRID, 7 * Block::GRID);
|
Block block4(5 * Block::GRID, 7 * Block::GRID);
|
||||||
Block block5(6 * 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);
|
ball1.setCharge(2);
|
||||||
ball2.setCharge(-2);
|
ball2.setCharge(-2);
|
||||||
block3.setCharge(10);
|
block3.setCharge(10);
|
||||||
|
block9.setCharge(-10);
|
||||||
|
|
||||||
engine.addObject(ball1);
|
engine.addObject(ball1);
|
||||||
engine.addObject(ball2);
|
engine.addObject(ball2);
|
||||||
|
@ -26,6 +31,10 @@ int main() {
|
||||||
engine.addObject(block3);
|
engine.addObject(block3);
|
||||||
engine.addObject(block4);
|
engine.addObject(block4);
|
||||||
engine.addObject(block5);
|
engine.addObject(block5);
|
||||||
|
engine.addObject(block6);
|
||||||
|
engine.addObject(block7);
|
||||||
|
engine.addObject(block8);
|
||||||
|
engine.addObject(block9);
|
||||||
|
|
||||||
engine.start();
|
engine.start();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue