FabGL
ESP32 Display Controller and Graphics Library
CollisionDetector Class Reference

A class to detect sprites collisions. More...

#include <collisiondetector.h>

Public Member Functions

 CollisionDetector (int maxObjectsCount, int width, int height)
 Creates an instance of CollisionDetector. More...
 
void addSprite (Sprite *sprite)
 Adds the specified sprite to collision detector. More...
 
SpritedetectCollision (Sprite *sprite, bool removeCollidingSprites=true)
 Detects first collision with the specified sprite. More...
 
void detectCollision (Sprite *sprite, CollisionDetectionCallback callbackFunc, void *callbackObj)
 Detects multiple collisions with the specified sprite. More...
 
void removeSprite (Sprite *sprite)
 Removes the specified sprite from collision detector. More...
 
void update (Sprite *sprite)
 Updates collision detector. More...
 
SpriteupdateAndDetectCollision (Sprite *sprite, bool removeCollidingSprites=true)
 Updates collision detector and detect collision with the specified sprite. More...
 
void updateAndDetectCollision (Sprite *sprite, CollisionDetectionCallback callbackFunc, void *callbackObj)
 Updates collision detector and detect multiple collisions with the specified sprite. More...
 

Detailed Description

A class to detect sprites collisions.

CollisionDetector uses a Quad-tree data structure to efficiently store sprites size and position and quick detect collisions.
CollisionDetector is embedded in Scene class, so usually you don't need to instantiate it.

Definition at line 133 of file collisiondetector.h.


The documentation for this class was generated from the following files: