1
General / Re: Function argumet.
« on: September 18, 2017, 12:44:40 am »
So its not possible to check that is mouse on button or not?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
double money = 20;But i get result:
....
sf::Text walletsk;
walletsk.setFont(calibri);
walletsk.setCharacterSize(18);
walletsk.setFillColor(sf::Color::White);
walletsk.setPosition(sf::Vector2f(660, 25));
walletsk.setString(to_string(money));
...
window.draw(walletsk);
sf::RectangleShape button1(sf::Vector2f(250, 70));And now i need do somethink if player pressed on this button:
button1.setPosition(sf::Vector2f(350, 200));
if (menu == 0) {but menu = 1 if i pressed in another place (not on button1). Can someone explain me why?
if (sf::Mouse::getPosition().x > 250 && sf::Mouse::getPosition().x < 600 &&
sf::Mouse::getPosition().y > 200 && sf::Mouse::getPosition().y < 270) {
if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) menu = 1;
}
int main()
{
sf::RenderWindow langas(sf::VideoMode(800, 600), "SM Bettings");
while (langas.isOpen()) {
sf::Event ev;
while (langas.pollEvent(ev)) {
if (ev.type == sf::Event::Closed)
langas.close();
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
langas.close();
}
}
langas.clear(sf::Color::Green);
langas.display();
return 0;
}
error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Blue" (?Blue@Color@sf@@2V12@B)code:
window.clear(sf::Color::Blue);
I helped you. But i see that you dont have any idea on game prgramming . At first you must know C++ better and Do some console games (CLI). Text based. Dont try make 2d/3d games right now! Learn at first!
if (sprite.GetPosition().x + sprite.GetSize().x == Window.GetInput().IsMouseButtonDown(sf::Mouse::Left))