Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Some error  (Read 1089 times)

0 Members and 1 Guest are viewing this topic.

Pein95

  • Newbie
  • *
  • Posts: 4
    • View Profile
Some error
« on: September 05, 2013, 10:02:35 pm »
if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
                {
                        sf::Vector2i MousePosition = sf::Mouse::getPosition(window);
                        for (int i=0; i<24; i++)
                        {
                                for (int j=0; j<24; j++)
                                {
                                       

                                        if((int)rect[i][j].getPosition().x < MousePosition.x&&
                                                (int)rect[i][j].getPosition().y < MousePosition.y &&
                                                (int)rect[i][j].getPosition().x + (int)rect[i][j].getGlobalBounds().width > MousePosition.x
                                                && (int)rect[i][j].getPosition().y + (int)rect[i][j].getGlobalBounds().height > MousePosition.y)
                                        {
                                                rect[i][j].setFillColor(sf::Color::Red);
                                                break;
                                        }
                                }
                        }
                       
                }

 
When I click on the some rect, I have error in this line:
if((int)rect[i][j].getPosition().x < MousePosition.x&&
                                                (int)rect[i][j].getPosition().y < MousePosition.y &&
                                                (int)rect[i][j].getPosition().x + (int)rect[i][j].getGlobalBounds().width > MousePosition.x
                                                && (int)rect[i][j].getPosition().y + (int)rect[i][j].getGlobalBounds().height > MousePosition.y)
 

Unhandled exception at 0x00F0F1C2 in Project2.exe: 0xC0000005: Access violation writing location 0x00180000.



binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Some error
« Reply #1 on: September 05, 2013, 10:28:00 pm »
Very descriptive thread title...
Very descriptive problem description...
Very descriptive code...

Nobody will be able to help you like this.

http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368

Have fun learning how to solve your own problems in C++ (this is a C++ problem and not related to SFML in any way).
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

 

anything