Skip to content

ViewportManager

Generated from engine/render/viewport_manager.h at f525bc6. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.

Browse the render module

Audience: game code.

#include "engine/render/viewport_manager.h" · namespace labrador

explicit ViewportManager(ResolutionManager* resolution_manager);

Takes no device, and no member of this class touches one: a ResolutionManager needs none, and every member here hands out a rectangle. That is what makes it constructible in a test. resolution_manager is borrowed and must outlive this manager; viewport queries read its current resolution rather than a stored size.

void set_layout(ScreenLayout layout);
ScreenLayout layout() const;
Viewport player_viewport(int player_num) const;

Pure arithmetic, all of it. Applying a viewport to a device is DrawList::set_viewport, which is why this class names no graphics type. What a viewport shows of the world through a camera is Camera::visible_rectangle, which is why it names no Camera either.

player_num indexes all_viewports(): [0, 1) for one player, [0, 2) for two, and [0, 4) for three and four players, since three players leave a fourth quadrant a whole-screen caller still draws. Throws std::out_of_range outside that range rather than answering with a fullscreen pane, which would draw a whole extra pass over the others (T6), as Renderer refuses a view nobody set up.

std::vector<Viewport> all_viewports() const;
std::vector<RectangleF> viewport_dividers() const;

The strips between the panes, in the same pixels as the viewports, and none for a one-player layout. What fills them is the game's business: this class hands out rectangles and draws nothing.

Viewport fullscreen_viewport() const;

Named in the public declarations above: RectangleF, ResolutionManager, ScreenLayout, Viewport.

The files that include this header directly. A file can also reach it through another header.

Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.

All documentation versions