34 #include "freertos/FreeRTOS.h" 61 Scene(
int maxSpritesCount,
int updateTimeMS = 20,
int width = Canvas.
getWidth(),
int height = Canvas.
getHeight());
92 void start(
bool suspendTask =
true);
102 virtual void init() = 0;
109 virtual void update(
int updateCount) = 0;
163 static void updateTimerFunc(TimerHandle_t xTimer);
169 TimerHandle_t m_updateTimer;
174 TaskHandle_t m_suspendedTask;
This file contains fabgl::CollisionDetector class definition.
Scene(int maxSpritesCount, int updateTimeMS=20, int width=Canvas.getWidth(), int height=Canvas.getHeight())
The Scene constructor.
Definition: scene.cpp:37
Represents a sprite.
Definition: vgacontroller.h:436
void stop()
Stops scene updates and resumes suspended task.
Definition: scene.cpp:63
virtual void init()=0
This is an abstract method called when the scene needs to be initialized.
int getHeight()
Determines scene height.
Definition: scene.h:77
void addSprite(Sprite *sprite)
Adds the specified sprite to collision detector.
Definition: scene.h:131
This file contains fabgl::CanvasClass definition and the related Canvas instance. ...
virtual void update(int updateCount)=0
This is an abstract method called whenever the scene needs to be updated.
A class to detect sprites collisions.
Definition: collisiondetector.h:129
int getWidth()
Determines the canvas width in pixels.
Definition: canvas.h:105
Scene is an abstract class useful to encapsulate functionalities of a scene (sprites, collision detector and updates).
Definition: scene.h:49
void removeSprite(Sprite *sprite)
Removes the specified sprite from collision detector.
Definition: scene.h:138
Represents the coordinate of a point.
Definition: fabutils.h:125
void update(Sprite *sprite)
Updates collision detector.
Definition: collisiondetector.cpp:422
Definition: canvas.cpp:47
int getHeight()
Determines the canvas height in pixels.
Definition: canvas.h:114
This file contains FabGL library configuration settings, like number of supported colors...
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.
Definition: collisiondetector.cpp:373
void removeSprite(Sprite *sprite)
Removes the specified sprite from collision detector.
Definition: collisiondetector.cpp:388
int getWidth()
Determines scene width.
Definition: scene.h:70
void updateSpriteAndDetectCollisions(Sprite *sprite)
Updates collision detector and generate collision events.
Definition: scene.cpp:86
void updateSprite(Sprite *sprite)
Updates collision detector.
Definition: scene.h:149
void start(bool suspendTask=true)
Starts scene updates and suspends current task.
Definition: scene.cpp:50