If I have a view, does this mean that I need to do this, to draw something as if it was drawn with a "view"?
Yes. Note that you can write it in a shorter way, using one of the implicit constructors of sf::RenderState:
target.draw(something, the_transform);
View transform doesn't contain Viewport in it! I wonder how I can get it into the equation...
Indeed, the viewport is a different thing and is not part of the transform. You can simply give the same viewport to the view that you're using to draw your stuff.
Indeed, the viewport is a different thing and is not part of the transform. You can simply give the same viewport to the view that you're using to draw your stuff.
Thanks! That was the missing part of the piece! In total, here's what I did:
target.setView(window.getLetterboxedView());
states.transform *= target.getView().getInverseTransform() * cameraView.getTransform();
And here's the result:
(https://i.imgur.com/ZJR8EZb.png)
UPD:
After some thinking, I can just do this, and it works too (because only viewport matters in letterbox view)!
auto view = cameraView;
cameraView.setViewport(window.getLetterboxedView().getViewport());
target.setView(view);
/* draw */