class SFML::View

A 2D camera. A View defines what part of the world is visible in the window: a centre point, a size in world units, an optional rotation, and a viewport rectangle (in normalised window coords [0,1]) that places the view inside the window β€” useful for split-screen or for rendering a mini-map alongside the main camera.

Two flows you’ll typically use:

# 1. Define from a centre + size: camera = SFML::View.new(center: [400, 300], size: [800, 600])

# 2. Define from a world rectangle (top-left + size): camera = SFML::View.from_rect(SFML::Rect.new([0, 0], [1600, 1200]))

window.view = camera # apply window.draw(stuff) # everything draws through the camera window.view = window.default_view # restore the 1:1 default

All coordinate inputs accept either a SFML::Vector2 or a [x, y] array.