38#include "freertos/FreeRTOS.h"
45#define FABGL_DEFAULT_SCENETASK_STACKSIZE 2048
68 Scene(
int maxSpritesCount,
int updateTimeMS,
int width,
int height,
int stackSize = FABGL_DEFAULT_SCENETASK_STACKSIZE);
99 void start(
bool suspendTask =
true);
116 virtual void update(
int updateCount) = 0;
170 static void updateTask(
void * pvParameters);
176 TaskHandle_t m_updateTaskHandle;
179 SemaphoreHandle_t m_mutex;
183 TaskHandle_t m_suspendedTask;
185 volatile bool m_running;
void addSprite(Sprite *sprite)
Adds the specified sprite to collision detector.
void update(Sprite *sprite)
Updates collision detector.
void removeSprite(Sprite *sprite)
Removes the specified sprite from collision detector.
A class to detect sprites collisions.
int getHeight()
Determines scene height.
Scene(int maxSpritesCount, int updateTimeMS, int width, int height, int stackSize=2048)
The Scene constructor.
virtual void collisionDetected(Sprite *spriteA, Sprite *spriteB, Point collisionPoint)=0
This is an abstract method called whenever a collision has been detected.
void addSprite(Sprite *sprite)
Adds the specified sprite to collision detector.
void updateSpriteAndDetectCollisions(Sprite *sprite)
Updates collision detector and generate collision events.
int getWidth()
Determines scene width.
void updateSprite(Sprite *sprite)
Updates collision detector.
void stop()
Stops scene updates and resumes suspended task.
virtual void init()=0
This is an abstract method called when the scene needs to be initialized.
void start(bool suspendTask=true)
Starts scene updates and suspends current task.
virtual void update(int updateCount)=0
This is an abstract method called whenever the scene needs to be updated.
void removeSprite(Sprite *sprite)
Removes the specified sprite from collision detector.
Scene is an abstract class useful to encapsulate functionalities of a scene (sprites,...
This file contains fabgl::CollisionDetector class definition.
This file contains FabGL library configuration settings, like number of supported colors,...
Represents the coordinate of a point.