Table of Contents

Interface IRenderSurface

Namespace
BSGameLib.Game.Rendering
Assembly
BSGameLib.Game.dll

Describes the logical render surface exposed to higher level systems (UI, gameplay, input).

public interface IRenderSurface

Properties

LogicalHeight

The height of the logical drawing area, in the units drawing and input use.

int LogicalHeight { get; }

Property Value

int

LogicalWidth

The width of the logical drawing area, in the units drawing and input use, whatever the window's pixel size.

int LogicalWidth { get; }

Property Value

int

PixelSize

The back buffer's size in physical pixels. The same as WindowSize except on a high-density display, where the window is measured in points and there are more pixels than points. Zero when unknown.

Vector2 PixelSize { get; }

Property Value

Vector2

ProjectionMatrix

The projection that maps logical coordinates to the back buffer.

Matrix4x4 ProjectionMatrix { get; }

Property Value

Matrix4x4

TracksWindowSize

Whether the logical size follows the window's: true until SetLogicalRenderSize(int, int) fixes it, and again after TrackWindowSize().

bool TracksWindowSize { get; }

Property Value

bool

WindowSize

Current window/back-buffer size.

Vector2 WindowSize { get; }

Property Value

Vector2

Methods

SetLogicalRenderSize(int, int)

Fixes the logical drawing area at width by height, however the window is later sized. It can be changed at any time; everything keyed off the logical size (the projection, frame-graph targets sized from it, input mapping) follows from the next frame. A size of zero or less is ignored.

void SetLogicalRenderSize(int width, int height)

Parameters

width int
height int

Remarks

The logical size is in whatever units the game draws in; the surface stretches it over the whole back buffer. To draw one logical unit per physical pixel, pass a size in pixels.

TrackWindowSize()

Makes the logical size follow the window's, now and on every resize: the default for a new surface, undoing SetLogicalRenderSize(int, int).

void TrackWindowSize()

WindowToLogical(Vector2)

Converts windowPosition, in window pixels, to logical coordinates.

Vector2 WindowToLogical(Vector2 windowPosition)

Parameters

windowPosition Vector2

Returns

Vector2

Events

LogicalSizeChanged

Raised on the game thread when LogicalWidth or LogicalHeight changes, whether set or following the window.

event Action LogicalSizeChanged

Event Type

Action