MCPcopy Create free account
hub / github.com/SFML/SFML / getViewport

Method getViewport

src/SFML/Graphics/RenderTarget.cpp:278–285  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

276
277////////////////////////////////////////////////////////////
278IntRect RenderTarget::getViewport(const View& view) const
279{
280 const auto [width, height] = Vector2f(getSize());
281 const FloatRect& viewport = view.getViewport();
282
283 return IntRect(Rect<long>({std::lround(width * viewport.position.x), std::lround(height * viewport.position.y)},
284 {std::lround(width * viewport.size.x), std::lround(height * viewport.size.y)}));
285}
286
287
288////////////////////////////////////////////////////////////

Callers 3

View.test.cppFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected