24 static const int STAR_COUNT = 100;
45 for (
int a = 0; a < STAR_COUNT; a++)
62 if (millis() >= m_lastRan + m_frameDelay and m_mode != 5)
65 for (
int a = 0; a < STAR_COUNT; a++)
70 m_stars[a].x += m_speed;
71 if (m_stars[a].x >= 240)
74 m_stars[a].x = random(m_speed);
79 m_stars[a].y -= m_speed;
83 m_stars[a].y = 319 - random(m_speed);
88 m_stars[a].y += m_speed;
89 if (m_stars[a].y >= 320)
92 m_stars[a].y = random(m_speed);
97 m_stars[a].x -= m_speed;
101 m_stars[a].x = 239 - random(m_speed);
104 else if (m_mode == 4)
106 m_stars[a].x += (m_stars[a].x - 120) * m_zoom;
107 m_stars[a].y += (m_stars[a].y - 160) * m_zoom;
108 if (m_stars[a].x < 0 or m_stars[a].x >= 240 or m_stars[a].y < 0 or m_stars[a].y >= 320)
126 if (button->isActive())
128 m_mode = button->getID();
136 struct Star m_stars[STAR_COUNT];
137 long m_lastRan = millis();
138 int m_frameDelay = 150;
144 void newRandomStar(
int a)
146 m_stars[a].col = random(16777215);
147 m_stars[a].size = random(3);
148 m_stars[a].size = random(m_stars[a].size);
151 m_stars[a].x = random(240);
152 m_stars[a].y = random(320);
153 }
while (m_stars[a].x == 120 and m_stars[a].y == 160);
158 if (m_stars[a].size == 0)
160 m_badge->
display().drawPixel(
int(m_stars[a].x),
int(m_stars[a].y), 0);
164 m_badge->
display().fillCircle(
int(m_stars[a].x),
int(m_stars[a].y), m_stars[a].size, 0);
170 if (m_stars[a].size == 0)
172 m_badge->
display().drawPixel(
int(m_stars[a].x),
int(m_stars[a].y), m_stars[a].col);
176 m_badge->
display().fillCircle(
int(m_stars[a].x),
int(m_stars[a].y), m_stars[a].size,
virtual bool handleButton(IButton *button)
Handle button presses.
Definition: StarsApp.h:121
Adafruit_ILI9341 & display()
Gets the TFT display driver.
Definition: Dilbert.h:44
AppManager * m_manager
Pointer to application manager.
Definition: App.h:130
virtual void onEntry()
Called when the application is entered.
Definition: App.h:70
virtual bool handleButton(IButton *button)
Handle button presses.
Definition: App.h:121
virtual void run()
Called in a loop while the application is active.
Definition: App.h:83
App(char *name)
Creates a new instance of a badge application.
Definition: App.h:22
virtual void onEntry()
Called when the application is entered.
Definition: StarsApp.h:39
virtual void run()
Definition: StarsApp.h:55
Dilbert * m_badge
Pointer to badge driver.
Definition: App.h:129
Displays Starfield.
Definition: StarsApp.h:21
Used to encapsulate an individual application.
Definition: App.h:15
void feedBacklight(uint8_t status=BACKLIGHT_STATE_FULL)
Ensures that the backlight stays on, otherwise it is susceptible to the timeouts set in SystemConfigD...
Definition: AppManager.cpp:152