SFML community forums

Help => General => Topic started by: LordNani on June 03, 2019, 08:00:43 pm

Title: Texture.update() is not working
Post by: LordNani on June 03, 2019, 08:00:43 pm
It says Assertion failed: x + window.getSize().x <= m_size.x
 :-\
Size and x\y are correct
It all breaks on last line. I need it for selection and copy/paste tool
        bufferRect.width = abs(curPos.x - point1.x);
        bufferRect.height = abs(curPos.y - point1.y);
        int width = bufferRect.width;
        int height = bufferRect.height;
        int x = bufferRect.left;
        int y = bufferRect.top;
        std::cout << "width is "<< bufferRect.width << std::endl;
        std::cout << "height is " << bufferRect.height << std::endl;
        std::cout << "left and top are " << bufferRect.left << " + " << bufferRect.top << std::endl;
       
        bufferTexture.create(width, height);
        bufferTexture.update(mainWindow,x ,y );
 
Title: Re: Texture.update() is not working
Post by: Laurent on June 03, 2019, 09:21:33 pm
Since we don't know how rect.left is calculated, and you don't show the result of your std::cout lines, there's nothing very helpful we can do. Of course I tend to trust the assert more than you ;)
Title: Re: Texture.update() is not working
Post by: LordNani on June 04, 2019, 12:29:32 am
Since we don't know how rect.left is calculated, and you don't show the result of your std::cout lines, there's nothing very helpful we can do. Of course I tend to trust the assert more than you ;)
Well, it was correct. The problem is that texture should not be created from part of the window. It is written in the documentation