Sets current rotation angle for 2D overlay images (degrees, affects image drawing). Takes angle (rotation angle in degrees, 0=no rotation, 90=quarter turn, 180=half turn, 360=full rotation, converted to radians internally). Returns nothing. Sets g_currentState.rotation (stores in radians, angle * pi / 180, persists until changed).
Sets current rotation angle for 2D overlay images (degrees, affects image drawing). Takes angle (rotation angle in degrees, 0=no rotation, 90=quarter turn, 180=half turn, 360=full rotation, converted to radians internally). Returns nothing. Sets g_currentState.rotation (stores in radians, angle * pi / 180, persists until changed). Use to rotate sprites (spinning effects, angled objects, directional sprites), create effects (rotating UI elements, spinning wheels), or orient images (match entity direction, point towards target). State behavior: stores rotation in radians (g_currentState.rotation converted from degrees, angle * 3.14159265 / 180), persists until changed (remains active across frames until b2dSetRotation called again), affects image drawing only (sprites, textures, NOT text or shapes), independent of other state (rotation separate from color, alpha, scale). Use cases: (1) Spinning sprite (b2dSetRotation(angle): animate rotation over time), (2) Angled UI (b2dSetRotation(45.0): draw diagonal arrow), (3) Directional sprite (b2dSetRotation(directionAngle): orient sprite towards movement), (4) Rotating wheel (b2dSetRotation(wheelAngle): spinning animation), (5) Fixed rotation (b2dSetRotation(90.0): draw sprite rotated 90 degrees). Common patterns: set = b2dSetRotation(angle) configure rotation; reset = b2dSetRotation(0.0) restore no rotation; animate = b2dSetRotation(MilliSecs() / 10.0) continuous spinning. Typical values: 0.0 no rotation (default, normal orientation, 0 degrees), 90.0 quarter turn (right angle, 90 degrees), 180.0 half turn (upside down, 180 degrees), 270.0 three-quarter turn (270 degrees), 360.0 full rotation (same as 0, completes circle), 45.0 diagonal (45 degree angle), continuous spinning (time-based angle for animation, wraps at 360). Rotation behavior: rotates around center (image rotated around center point, NOT top-left corner), clockwise rotation (positive angles rotate clockwise, negative counter-clockwise), combined with scale (rotation applied AFTER scale in transform order), angle wrapping (angles >360 or <0 work correctly, engine handles wrapping). No clamping: values NOT clamped (any angle accepted, including negative and >360), negative angles valid (rotate counter-clockwise, -90 = 270), large angles OK (>360 rotates multiple times, equivalent to angle % 360). Performance: set cost zero (single float assignment with multiplication, trivial CPU operation), state read every draw (GPU reads rotation from transform matrix, minimal cost), safe to change frequently (no GPU sync, instant state change), rotated drawing same cost (GPU rotates vertices, no performance difference from non-rotated). Affects images only: sprites rotated (image drawing commands b2dDrawImage affected), text NOT rotated (text rendering ignores rotation state), shapes NOT rotated (rectangle/line drawing ignores rotation, draw rotated shapes manually). Degrees to radians: automatic conversion (engine converts degrees to radians internally, radians = degrees * pi / 180), user uses degrees (API accepts degrees for familiarity, matches Blitz3D convention), internal radians (GPU uses radians for sin/cos calculations). Related: b2dSetScale sets image scale (scaleX/scaleY, combined with rotation), b2dSetColor sets RGB color (tints images with color multiply), b2dSetAlpha sets transparency (alpha blending for images).