Sets current draw color for 2D overlay (RGB 0-255, affects subsequent draw commands).
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 current draw color for 2D overlay (RGB 0-255, affects subsequent draw commands).
Takes r (red component 0-255 integer), g (green component 0-255 integer), b (blue component 0-255 integer).
Returns nothing.
Technical Exegesis...
Sets current draw color for 2D overlay (RGB 0-255, affects subsequent draw commands). Takes r (red component 0-255 integer), g (green component 0-255 integer), b (blue component 0-255 integer). Returns nothing. Sets g_currentState.r/g/b (stores in global state, persists until changed). Use to set draw color (text, lines, rectangles, sprites), change color dynamically (animated effects, conditional coloring), or tint images (multiply image pixels by color).
Sets current draw color for 2D overlay (RGB 0-255, affects subsequent draw commands). Takes r (red component 0-255 integer), g (green component 0-255 integer), b (blue component 0-255 integer). Returns nothing. Sets g_currentState.r/g/b (stores in global state, persists until changed). Use to set draw color (text, lines, rectangles, sprites), change color dynamically (animated effects, conditional coloring), or tint images (multiply image pixels by color). State behavior: stores color in state (g_currentState RGB values, affects all subsequent draw commands), persists until changed (remains active across frames until b2dSetColor called again), affects all draw operations (text, shapes, images, sprites), independent alpha (color separate from alpha set by b2dSetAlpha). Use cases: (1) Draw colored text (b2dSetColor(255, 255, 0): draw yellow text), (2) Draw shapes (b2dSetColor(255, 0, 0): draw red rectangle), (3) Tint sprites (b2dSetColor(128, 128, 255): draw sprite with blue tint), (4) Conditional coloring (If health < 50 Then b2dSetColor(255, 0, 0) Else b2dSetColor(0, 255, 0)), (5) Animated effects (b2dSetColor(pulse, pulse, pulse): pulsing brightness). Common patterns: set = b2dSetColor(r, g, b) configure color; white = b2dSetColor(255, 255, 255) reset to normal. Typical values: white 255, 255, 255 (no tinting, default), black 0, 0, 0 (fully dark), red 255, 0, 0 (pure red), green 0, 255, 0 (pure green), blue 0, 0, 255 (pure blue), yellow 255, 255, 0 (red+green), cyan 0, 255, 255 (green+blue), magenta 255, 0, 255 (red+blue), gray 128, 128, 128 (50% brightness), custom colors any 0-255 combination. Color multiplication: images tinted (image RGB multiplied by current color, white=no tint, black=fully dark), text colored (font rendered in current color), shapes filled (rectangles/circles filled with current color), additive NOT supported (color is multiplicative only, can't brighten white pixels). No clamping: values NOT clamped (user responsible for 0-255 range, values outside may wrap or cause undefined behavior), negative values undefined (implementation doesn't clamp, may cause issues), values >255 undefined (may wrap to 0-255 or cause artifacts). Performance: set cost zero (three integer assignments, trivial CPU operation), state read every draw (GPU reads color from constant buffer, minimal cost), safe to change frequently (no GPU sync, instant state change). Related: b2dSetAlpha sets transparency (0.0-1.0, independent from RGB color), b2dSetScale sets sprite scale (scaleX/scaleY for image drawing), b2dSetRotation sets sprite rotation (angle in degrees for image drawing).