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.

Topics - M74

Pages: [1]

please take a look at these 2 functions:

        sf::RectangleShape m_shape;

        bool getIsMouseHover_A(int x, int y)
                sf::FloatRect rect = m_shape.getGlobalBounds();
                return (x >= rect.left && x < rect.left + rect.width && y >= rect.top && y < rect.top + rect.height);

        bool getIsMouseHover_B(int x, int y)
                return (m_shape.getGlobalBounds().contains((float)x, (float)y));

While method "_A" works fine the method "_B" does not even compile on my Visual Studio 2017.
The compiler complains about Line #81 in sf::RectInl.
    // Compute the real min and max of the rectangle on both axes
    T minX = std::min(left, static_cast<T>(left + width));

What`s the reason for this? Did i miss something?


Graphics / Zoom a sf::View to Mouse-Point Center?
« on: January 26, 2015, 11:40:35 pm »

i`m currently working on a synthesizer program where i can place my virtual devices on a virtual desktop, which i can Zoom and Pan:

This works fine now, thanks to the sf::View :D

But... if i Zoom-In with the Mousewheel i also would like to pan the whole virtual desktop to the Device where the Mouse points to.

At first i thought this would be simple, if i would set the View-Center to the current Mouse-Coordinates, but unfortunately this does not seem to work so simple (if i try it this way the whole desktop-panning flickers in all directions).

Please take a look at my attached screenshot and imagine that the user points the mouse over the Device "Grainshifter" and rotates the Mousewheel. In this case the virtual desktop not only should Zoom In - it also should scroll to the device where the mouse points to. I often see this behavior in similar programs but i have no idea how i could implement this (currently the Zoom works only with the Center-Point set to the center of the whole screen).

I also found a similar question in this forum, but it was not answered there.

Does someone have a idea how to implement this?

Please excuse my bad english :)


Graphics / sf::View on sf::RenderTexture?
« on: January 25, 2015, 07:28:57 pm »

i tried the sf::View on a sf::RenderWindow and it works fine.
But when i try to use the View on a sf::RenderTexture it seems to not work.

Is this correct or do i something wrong?


Graphics / "Cost" of flipping sprites?
« on: January 22, 2015, 11:40:46 pm »

i`ve read the topic of how to flip a sprite: http://en.sfml-dev.org/forums/index.php?topic=7572.0

I was wondering if this is some sort of unperformant if i have to flip a greater amount of sprites and better should provide also pre-flipped versions of my sprites in my Spritesheet(s) or is it negligable to flip/scale sprites?

Please excuse my english.


Graphics / Maximum size of a sf::View?
« on: January 20, 2015, 09:44:26 pm »

could someone please explain me if a sf::View can be bigger than the maximum allowed texture size?

For example on an old test-computer with Windows Dx9 i have a hardware maximum texture size of only 2048x2048 pixels, so i tried to initialize a view with a size of 32768x32768 on this computer and got no error.

I initially thought that also the view is limited to the maximum texture size and i have to write my own texture mapping to achive a bigger size of the view, but since i got no error in creating a bigger view i was wondering if SFML handles this internally already somehow?

Please excuse my bad english :-)

Many thanks for all answers in advance,

Pages: [1]