Frees image and releases GPU resources (releases texture, removes from map).
Takes imageHandle (image handle from b2dLoadImage/b2dLoadAnimImage, positive integer).
Returns nothing.
2D Overlay
Parameters & Returns
Parameters
imageHandleInt
Returns
Void
Quick Summary
Frees image and releases GPU resources (releases texture, removes from map).
Takes imageHandle (image handle from b2dLoadImage/b2dLoadAnimImage, positive integer).
Returns nothing.
Technical Exegesis...
Frees image and releases GPU resources (releases texture, removes from map). Takes imageHandle (image handle from b2dLoadImage/b2dLoadAnimImage, positive integer). Returns nothing. Releases GPU texture (ID3D12Resource->Release, frees VRAM), removes from g_images map (erases entry, handle becomes invalid). Use to free unused images (release memory when image no longer needed), cleanup on exit (free all images before program close), or dynamic loading (free old images when loading new level).
Frees image and releases GPU resources (releases texture, removes from map). Takes imageHandle (image handle from b2dLoadImage/b2dLoadAnimImage, positive integer). Returns nothing. Releases GPU texture (ID3D12Resource->Release, frees VRAM), removes from g_images map (erases entry, handle becomes invalid). Use to free unused images (release memory when image no longer needed), cleanup on exit (free all images before program close), or dynamic loading (free old images when loading new level). Free behavior: checks handle exists (looks up in g_images map, ignores if not found), releases texture (calls texture->Release, GPU memory freed), removes map entry (g_images.erase, handle invalidated), silent if not found (safe to call with invalid handle, no error). Use cases: (1) Cleanup on exit (For Each img: b2dFreeImage(img) free all before close), (2) Level transition (free old level images, load new level images), (3) Dynamic loading (free temporary images after use), (4) Memory management (free large images when done to free VRAM), (5) Error recovery (free partially loaded images on error). Common patterns: free = b2dFreeImage(img) release image; batch = For Each img: b2dFreeImage(img) free multiple. Performance: free cost minimal (texture->Release + map erase, ~0.01-0.1ms), frees VRAM (GPU memory returned to pool, available for new allocations), doesn't sync GPU (immediate free, doesn't wait for GPU to finish using texture, ensure image not in use). Validation: ignores if handle <= 0 or not found (safe to call with invalid handle, silent no-op), doesn't check if texture in use (user must ensure image not currently being drawn, drawing freed image may crash). Image lifetime: manual management (user must call b2dFreeImage, engine doesn't auto-free), persistent until freed (images remain in memory across frames until explicitly freed), handle invalidated (after freeing, handle no longer valid, don't reuse). Related: b2dLoadImage loads image (creates image freed by this function), b2dLoadAnimImage loads animation sheet (creates image freed by this function), b2dCopyImage copies image (creates independent copy, original and copy must both be freed separately).