SFML-Website icon indicating copy to clipboard operation
SFML-Website copied to clipboard

3.0 Migration guide does not give guidance for change to sf::RenderStates constructor

Open redinator2000 opened this issue 10 months ago • 0 comments

In 2.6.x, there is this constructor

RenderStates::RenderStates(const BlendMode& theBlendMode, const Transform& theTransform, const Texture* theTexture, const Shader* theShader);

Commits https://github.com/SFML/SFML/commit/ebf485737fc6c0dc08f576273f2d6186bf9259da and https://github.com/SFML/SFML/commit/eb07e1e6c57f45fe37a1e057bbcc90154141e059 changed this constructor 3.0.0

RenderStates::RenderStates(const BlendMode&   theBlendMode,
                 const StencilMode& theStencilMode,
                 const Transform&   theTransform,
                 CoordinateType     theCoordinateType,
                 const Texture*     theTexture,
                 const Shader*      theShader);

It is not clear how to replicate the same behavior. I see two options

  1. Use RenderStates::RenderStates() and then set every not-new member with operator=, since they are public members of the RenderStates struct
  2. Read RenderStates.hpp and assume the 2.6.x-like defaults for the new arguments to the constructor are StencilMode() and CoordinateType::Pixels

The only line in the migration guide that might help with this is "Added new sf::CoordinateType enumeration to sf::RenderStates::RenderStates" https://www.sfml-dev.org/tutorials/3.0/getting-started/migrate/#other-minor-changes

I suggest adding something to the migration guide for this change, especially what StencilMode to use to not change behavior

redinator2000 avatar Mar 29 '25 01:03 redinator2000