Extended animation draw (per-draw custom shader with frame selection, combines animation + shader).
Takes imageHandle (animation image handle from b2dLoadAnimImage, positive integer), x (screen X position in pixels, integer), y (screen Y position in pixels, integer), frame (frame index 0-based, integer, 0=first frame), shader (shader handle from b2dLoadImageShader or 0 for default, integer).
Returns nothing.
2D Overlay
Parameters & Returns
Parameters
imageHandleInt
xInt
yInt
frameInt
shaderInt
Returns
Void
Quick Summary
Extended animation draw (per-draw custom shader with frame selection, combines animation + shader).
Takes imageHandle (animation image handle from b2dLoadAnimImage, positive integer), x (screen X position in pixels, integer), y (screen Y position in pixels, integer), frame (frame index 0-based, integer, 0=first frame), shader (shader handle from b2dLoadImageShader or 0 for default, integer).
Returns nothing.
Technical Exegesis...
Extended animation draw (per-draw custom shader with frame selection, combines animation + shader). Takes imageHandle (animation image handle from b2dLoadAnimImage, positive integer), x (screen X position in pixels, integer), y (screen Y position in pixels, integer), frame (frame index 0-based, integer, 0=first frame), shader (shader handle from b2dLoadImageShader or 0 for default, integer). Returns nothing.
Extended animation draw (per-draw custom shader with frame selection, combines animation + shader). Takes imageHandle (animation image handle from b2dLoadAnimImage, positive integer), x (screen X position in pixels, integer), y (screen Y position in pixels, integer), frame (frame index 0-based, integer, 0=first frame), shader (shader handle from b2dLoadImageShader or 0 for default, integer). Returns nothing. Calculates frame UV coordinates (frameX/frameY from frame index and grid layout), creates draw command (CMD_DRAW_ANIM_IMAGE type with shader parameter), queues to command buffer (executed during b3dRenderWorld), shader applied during GPU rendering (custom pixel shader replaces default if shader > 0). Use to apply effects to animated sprites (glowing animated powerup, flashing damaged enemy), selective animation effects (shader only for certain animation frames or states), or dynamic animated effects (conditional shaders on animated sprites). Combines features: frame selection from b2dDrawAnimImage (selects frame from sprite sheet by index), shader application from b2dDrawImageEx (applies custom pixel shader per-draw), state application (color, alpha, scale, rotation from g_currentState). Use cases: (1) Glowing animation (b2dDrawAnimImageEx(portal, x, y, frame, glowShader): animated glowing portal), (2) Damage flash animation (b2dDrawAnimImageEx(enemy, x, y, walkFrame, flashShader): walking enemy flashing red on hit), (3) Selection outline on animation (b2dDrawAnimImageEx(unit, x, y, animFrame, outlineShader): animated selected unit with outline), (4) Conditional animation effect (If powerUp Then b2dDrawAnimImageEx(player, x, y, runFrame, powerShader) Else b2dDrawAnimImageEx(player, x, y, runFrame, 0)), (5) Animated UI with effects (b2dDrawAnimImageEx(spinner, x, y, spinFrame, blurShader): spinning loading icon with motion blur). Common patterns: animate with shader = frame = (frame + 1) Mod count: b2dDrawAnimImageEx(img, x, y, frame, shader) cycle frames with effect; conditional = If hit Then shader = flash Else shader = 0: b2dDrawAnimImageEx(img, x, y, frame, shader). Frame selection: same as b2dDrawAnimImage (0-indexed, row-major grid layout, frameX = frame % framesPerRow, frameY = frame / framesPerRow), valid range 0 to frameCount-1 (use b2dGetAnimFrameAmount for bounds), UV calculation automatic (engine calculates texture coordinates for selected frame). Shader behavior: same as b2dDrawImageEx (shader=0 default rendering, shader>0 custom pixel shader, per-draw override, independent of global state), shader processes frame (custom shader receives selected frame's pixels, can apply effects to animation). State application: color/alpha/scale/rotation from g_currentState (captured at queue time), shader additonal processing (custom shader processes after state transforms), position top-left (x,y specify top-left corner of frame), transforms from center (scale/rotation around frame center). Performance: combines costs (frame UV calculation + shader processing, ~0.001-1ms depending on shader complexity), shader prevents batching (different shaders break batching, PSO switch per shader change ~0.01ms), recommend batch by shader (draw all same-shader images together for efficiency). Validation: ignores if imageHandle invalid (handle not found in g_images map, silently skips draw), frame bounds not checked (out-of-bounds may wrap or cause artifacts, user responsible), shader validation minimal (shader>0 used if found, invalid shader falls back to default). Related: b2dDrawAnimImage standard animation (no shader parameter, always default rendering), b2dDrawImageEx image with shader (no frame selection, draws full image with shader), b2dLoadAnimImage loads sprite sheet (creates animation image used by this function), b2dLoadImageShader loads custom shader (creates shader used by this function), b2dSetImageShaderFloat sets shader parameter (configures shader uniforms), b2dGetAnimFrameAmount queries frame count (returns max frames for bounds checking).