TheMatrix/Firecracker
sparklie.h
1 #pragma once
2 
3 #include <LRAS1130.h>
4 
5 
9 class Sparklie {
10 public:
11  Sparklie();
12 
16  bool recalculate(bool with_regeneration);
17 
20  void clear(lr::AS1130Picture24x5& page);
21 
24  void draw(lr::AS1130Picture24x5& page, lr::AS1130& driver);
25 
26 private:
27  uint8_t max_height; // pre-calculated peak height
28  uint8_t max_displacement; // pre-calculated final displacement
29  uint8_t x; // current position (0-23) aka "height"
30  uint8_t y; // current position (0-4) aka "displacement"
31  uint16_t ttl; // the time to live after the sparklie has "returned to earth"
32  int8_t ticks_per_step; // how many animation ticks between movement
33  int8_t tick_counter; // current step tick counter
34  bool alive; // if sparklie is alive
35  bool up; // if sparklie is currently moving up
36 
39  bool shouldRegenerate();
40 
43  void initialiseSettings();
44 
45 };
void clear(lr::AS1130Picture24x5 &page)
Command: clears the sparkle display on the given page.
Definition: sparklie.cpp:50
void draw(lr::AS1130Picture24x5 &page, lr::AS1130 &driver)
Command: draws the sparkle display on the given page and driver.
Definition: sparklie.cpp:55
particle actor Each sparlie represents a single animation element
Definition: sparklie.h:9
bool recalculate(bool with_regeneration)
Command: recalculates the sparkles next position if it is alive, else might regenerate if with_regene...
Definition: sparklie.cpp:15