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 - Dar13

Pages: [1]
1
In light of that, why not overload the method in RenderWindow(where the class does know sf::View)?

//RenderWindow.cpp
void setSize(Vector2u size, bool autoResizeView)
{
    this->setSize(size);

    if(autoResizeView)
    {
         setView(sf::View(sfVector2u(size.x / 2,size.y / 2), size));
    }
}

And about only covering half the issue, I assume that if the developer is handling manual resizing they can also handle manually resizing the view. This is more of a convenience request, so if no is no then I'll drop it quick enough.  ::)

2
Just dealt with an issue with my app/game where I didn't know that setSize didn't adjust the RenderWindow's view as well.

My proposed patch would have an optional(default value would be false) boolean flag appended to the sf::RenderWindow::setSize() method that controls whether setSize would also resize the application's view. It wouldn't break API compatibility since it's defaulted to false while allowing future users to automatically resize their view to match their window size.

Quick snippet of how I would go about it.
//Window.h
void setSize(const Vector2u size, bool autoResizeView = false);

//snip

//Window.cpp
void Window::setSize(const Vector2u size,bool autoResizeView)
{
    if (m_impl)
    {
        m_impl->setSize(size);

        if(autoResizeView)
            m_impl->setView(View(Vector2u(size.x / 2, size.y / 2), size));
    }
}

Or if you don't wish to go down that route, I suggest updating the documentation of setSize to explicitly state that it doesn't affect the render window's view.

Pages: [1]
anything