b2dGraphics

Opens the graphics window and initialises the 2D rendering context. Call once in Main() before any drawing.

2D Overlay

Parameters & Returns

Parameters

resWidth Int
resHeight Int
graphicsMode Int

Returns

Int

Quick Summary

Opens the graphics window and initialises the 2D rendering context. Call once in Main() before any drawing.

Technical Exegesis...

Creates a window of resWidth x resHeight and starts the DirectX 12 2D pipeline: back buffer, the depth buffer used by b2dSetDepth, and the primitive/image/text batching. graphicsMode selects the windowing / vsync behaviour (see the BBR_WINDOW_MODE_* constants). This is the first graphics call a program makes - loading fonts and images and every b2d* draw call depend on it. Returns non-zero on success. (On the web target the equivalent call is awaited automatically inside Main().)

Example

Example.bam
b2dGraphics(800, 600, BBR_WINDOW_MODE_WT)
sysSetWindowTitle("My App")