C-style cast instead of functional cast
This commit is contained in:
8
main.cpp
8
main.cpp
@@ -18,14 +18,14 @@ int main()
|
|||||||
if(rectangle.getSize().x > 5 && rectangle.getSize().y > 5 && rectangle.getSize().x < 300 && rectangle.getSize().y < 300) {
|
if(rectangle.getSize().x > 5 && rectangle.getSize().y > 5 && rectangle.getSize().x < 300 && rectangle.getSize().y < 300) {
|
||||||
rectangle.setSize(rectangle.getSize() + sf::Vector2f(sizeIncrement, sizeIncrement));
|
rectangle.setSize(rectangle.getSize() + sf::Vector2f(sizeIncrement, sizeIncrement));
|
||||||
rectangle.setPosition(
|
rectangle.setPosition(
|
||||||
float(window.getSize().x) / 2 - rectangle.getSize().x / 2,
|
static_cast<float>(window.getSize().x) / 2 - rectangle.getSize().x / 2,
|
||||||
float(window.getSize().y) / 2 - rectangle.getSize().y / 2
|
static_cast<float>(window.getSize().y) / 2 - rectangle.getSize().y / 2
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
rectangle.setSize(sf::Vector2f(120.0f, 50.0f));
|
rectangle.setSize(sf::Vector2f(120.0f, 50.0f));
|
||||||
rectangle.setPosition(
|
rectangle.setPosition(
|
||||||
float(window.getSize().x) / 2 - rectangle.getSize().x / 2,
|
static_cast<float>(window.getSize().x) / 2 - rectangle.getSize().x / 2,
|
||||||
float(window.getSize().y) / 2 - rectangle.getSize().y / 2
|
static_cast<float>(window.getSize().y) / 2 - rectangle.getSize().y / 2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user