SDL Collide

From Wikipedia, the free encyclopedia

SDL_Collide is a collision detection library for use with SDL.

[edit] History

Started by Amir Taaki, SDL_Collide was a 2D collision detection algorithm originally intended for use in a 2D Linux rpg [1]. Due to the lack of availability compared to most of internet topics on 2D collision detection at the time, the author coded his own set of helper functions for collision detection. As the author's attention waned due to lack of demand for a 2D OpenSource rpg and fueled by difficulties of many members (even experienced) mainly around GameDev. Initial releases gained interest and as it was posted it got refined each time.

After being refined to a point from various comments it got put on the SDL project pages.

Soon after saw the contribution of two more methods from Rob Loach, and it was tidied up further.

[edit] Function Listing

Function Description
SDL_CollideTransparentPixelTest Helper function that is exposed for usefulness. Tests if a pixel is transparent.
SDL_CollidePixel Pixel Perfect collision test between two surfaces
SDL_CollideBoundingBox Bounding box intersection tests (either SDL_Rect or Surface and position)
SDL_CollideBoundingCircle Circle tests either on parameters or using a surface to approximate radius (based on width and height average)

[edit] References: