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

Show Posts

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.


Messages - Valmond

Pages: [1]
1
Graphics / Re: Sprite clipping not working correctly (HD 2500)
« on: December 02, 2018, 11:44:29 pm »
Hah, I had to read it all just to understand your viewpoint (uint good or bad) :-)

Yes, in my opinion too, signed integers is the way to go, and as you pointed out, SFML is not for impossibly big images (I work with TB sized 3D data, we use signed ints when we don't use floats, which are signed too of course).

But the most important IMO is that unsigned ints make pesky bugs like this where it could have been avoided.
Now I know about this particularity, but lots of others might try to check out SFML and just think it's broken or give up or annoy people on the forum :-).

+1 from me

Cheers

Valmond

2
Graphics / Re: Sprite clipping not working correctly (HD 2500)
« on: December 02, 2018, 09:20:10 pm »
Ouch, thank you for this detailed answer!

Question closed then. Remains why ever someone would use an unsigned integer for this kind of data :-)

I know, it might seem logic, but signed ints everywhere would have prevented this, and added the bonus of being able to have negative sized images (e.g flipped).

Anyway, thanks again and I can now remove one line per draw call and just make a cast :-)

Cheers

3
Graphics / Re: Sprite clipping not working correctly (HD 2500)
« on: December 02, 2018, 06:01:04 pm »
Well that would make no sense, as if I assign it to a variable before the setPosition call, it works.

I'm all new to SFML so I don't have the debug binaries. But for someone that can build SFML and debug in the SFML code, I think they could figure out the problem.

I'm work-arounding by first collecting the size, then call the setPosition, which is okay for me. Maybe there is a bugtracker somewhere where I can assign this?

4
Graphics / Re: Sprite clipping not working correctly (HD 2500)
« on: December 02, 2018, 01:10:13 pm »
Hi, here is a small example, the bug appears when getSize is used in the setPos call...
The image used is a png with the size of 80x92 pixels


#include <SFML/Graphics.hpp>

int main()
{
    // Create the main window
    sf::RenderWindow app(sf::VideoMode(800, 600), "Test");

    // Load a sprite to display
    sf::Texture t1;
    if (!t1.loadFromFile("../media/gfx/ball.png"))return EXIT_FAILURE;
    sf::Sprite s1(t1);
       
        // Start the game loop
    while (app.isOpen())
    {
        // Process events
        sf::Event event;
        while (app.pollEvent(event))
        {
            // Close window : exit
            if (event.type == sf::Event::Closed)
                app.close();
        }

        // Clear screen
        app.clear();

        // Draw the sprites
               
                //just loop from 150 to 50 over and over so the sprite moves out of screen
                static float pp=150;
                pp=pp-.03f;
                if(pp<50)pp=150;

                //Here is the bug, if I don't use the t1.getSize().y in the function call, it works
                //Bug
                s1.setPosition(100-t1.getSize().x/2,-t1.getSize().y+(int)pp);
                app.draw(s1);
               
                //works
                int t=t1.getSize().y;
                s1.setPosition(300-t1.getSize().x/2,-t+(int)pp);
                app.draw(s1);
               
        // Update the window
        app.display();
    }

    return EXIT_SUCCESS;
}

 

5
Graphics / Sprite clipping not working correctly (HD 2500)
« on: December 02, 2018, 12:23:02 am »
Hi everybody!

I have a small issue which is that when I draw a sprite with a negative position (in x or y), then it is not clipped (which it should as it's partially outside of the screen), but not drawn at all.

If I move the sprite to the right or downwards enough, so that the image is drawn "half outside" the window, then it works (the image is drawn but clipped by the physical window). But moving up or to the left, the sprite just pops out of existence as soon as x or y goes below zero.

Is this known / normal behavior / a HD2500 bug / other?

BTW I'm on Linux Mint, with a i3 3320 that has inbuilt HD 2500 graphics.

Thank you for any kind of help!

Cheers

Valmond

Pages: [1]
anything