// r_splitscreen.h -- renders every in-game player's viewpoint into its own
// grid cell for phone-join play, instead of the usual single full-window
// view of consoleplayer. Active whenever any player slot is remote-input
// (see player_t::RemoteInputSlot, src/net/webjoin) -- ordinary LAN/internet
// multiplayer is unaffected, since each of those processes still only ever
// has consoleplayer's own RemoteInputSlot false.
//
// Each active player gets a persistent off-screen FCanvasTexture, rendered
// fresh every frame via the same screen->RenderTextureView() mechanism
// camera-texture wall surfaces use (see hw_entrypoint.cpp), then the 2D
// phase blits each one, scaled, into its cell of the grid. This only
// covers the DFrameBuffer-based backends (GL, GLES, Vulkan, PolyRenderer);
// the legacy true-software renderer path is not yet implemented.
#pragma once

// True if the grid renderer should be used this frame instead of the
// normal single-view RenderView(&players[consoleplayer]).
bool WJ_SplitscreenActive();

// Renders every active player's view into its per-player offscreen canvas
// texture. Call once per frame, in place of RenderView(), before the 2D
// phase begins. HW/DFrameBuffer backends only -- caller should fall back
// to the normal single view when !V_IsHardwareRenderer().
void WJ_UpdateSplitscreenViews();

// Blits each player's rendered canvas texture into its grid cell, plus a
// compact name/health label. Call during the 2D phase (after twod->Begin),
// in place of the normal single-viewport HUD.
void WJ_DrawSplitscreenGrid();
