Sets background clear color for 2D overlay (RGB 0-255, used when b2dCls clears overlay).
Takes r (red component 0-255 integer), g (green component 0-255 integer), b (blue component 0-255 integer).
Returns nothing.
2D Overlay
Parameters & Returns
Parameters
rInt
gInt
bInt
Returns
Void
Quick Summary
Sets background clear color for 2D overlay (RGB 0-255, used when b2dCls clears overlay).
Takes r (red component 0-255 integer), g (green component 0-255 integer), b (blue component 0-255 integer).
Returns nothing.
Technical Exegesis...
Sets background clear color for 2D overlay (RGB 0-255, used when b2dCls clears overlay). Takes r (red component 0-255 integer), g (green component 0-255 integer), b (blue component 0-255 integer). Returns nothing. Sets g_clsColorR/G/B (stores normalized 0.0-1.0 values, r/255, g/255, b/255, clamped to 0-255 range).
Sets background clear color for 2D overlay (RGB 0-255, used when b2dCls clears overlay). Takes r (red component 0-255 integer), g (green component 0-255 integer), b (blue component 0-255 integer). Returns nothing. Sets g_clsColorR/G/B (stores normalized 0.0-1.0 values, r/255, g/255, b/255, clamped to 0-255 range). Use to set clear color (background color when b2dCls called), change background dynamically (animated backgrounds, conditional colors), or match scene aesthetics (dark background for night scenes, light for day). State behavior: stores color normalized (g_clsColorR/G/B as 0.0-1.0 floats, RGB values divided by 255), clamped to valid range (values <0 set to 0, values >255 set to 255), persists until changed (remains active until b2dSetClsColor called again), used by b2dCls (clear color applied when clearing overlay commands). Use cases: (1) Dark background (b2dSetClsColor(0, 0, 0): black clear color), (2) Light background (b2dSetClsColor(255, 255, 255): white clear color), (3) Colored background (b2dSetClsColor(64, 128, 192): blue-gray clear), (4) Match scene (b2dSetClsColor(skyR, skyG, skyB): match 3D sky color), (5) Animated background (b2dSetClsColor(pulse, pulse, pulse): pulsing brightness). Common patterns: set = b2dSetClsColor(r, g, b) configure clear color; black = b2dSetClsColor(0, 0, 0) reset to black. Typical values: black 0, 0, 0 (default, dark background, typical for overlays), white 255, 255, 255 (bright background, light themes), dark gray 32, 32, 32 (slightly brighter than black, softer look), light gray 224, 224, 224 (slightly darker than white, softer look), sky blue 135, 206, 235 (match outdoor scenes), dark blue 0, 0, 64 (night scenes), custom colors any 0-255 combination (match game aesthetics). Clear behavior: used by b2dCls (when b2dCls called, clears overlay render target to this color), NOT automatic (clear color only applied when b2dCls explicitly called), persistent until b2dFlip (overlay commands accumulate until b2dFlip, then cleared for next frame). Clamping automatic: values <0 clamped to 0 (negative RGB treated as 0, black component), values >255 clamped to 255 (over-bright RGB treated as 255, full intensity), user doesn't need to clamp (engine handles range validation automatically). Performance: set cost zero (three integer clamps and three divisions, trivial CPU operation), clear cost minimal (render target clear operation, ~0.01ms), safe to change frequently (no GPU sync, instant state change). Difference from b2dSetColor: b2dSetClsColor sets clear/background color (used by b2dCls for clearing), b2dSetColor sets draw color (affects text, shapes, images), independent state (clear color separate from draw color). Related: b2dCls clears 2D overlay (uses clear color set by this function), b2dSetColor sets draw color (different from clear color, affects subsequent draw commands).