Standalone imp (#2791)

* Moved ui elements to common folder in standalone, and add screen parameters to the api v4

* pass it as a pointer, so if standalone app supports it can change
This commit is contained in:
Totoo 2025-09-16 20:29:05 +02:00 committed by GitHub
parent d80f41e9d7
commit 9afd3a9dca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 39 additions and 14 deletions

View file

@ -45,17 +45,19 @@ bool OnKeyboad(uint8_t);
void PaintViewMirror();
extern const standalone_application_api_t* _api;
extern uint16_t screen_height;
extern uint16_t screen_width;
class DigitalRain {
private:
ui::Painter painter{};
static const int WIDTH = 240;
static const int HEIGHT = 325;
static const int MARGIN_TOP = 20;
static const int CHAR_WIDTH = 5;
static const int CHAR_HEIGHT = 8;
static const int COLS = WIDTH / CHAR_WIDTH;
static const int ROWS = (HEIGHT - MARGIN_TOP) / CHAR_HEIGHT;
int WIDTH = 0; // 240;
int HEIGHT = 0; // 325;
int MARGIN_TOP = 20;
int CHAR_WIDTH = 5;
int CHAR_HEIGHT = 8;
int COLS = 0; // WIDTH / CHAR_WIDTH;
int ROWS = 0; //(HEIGHT - MARGIN_TOP) / CHAR_HEIGHT;
static const int MAX_DROPS = 36;
const ui::Font& font = ui::font::fixed_5x8();
@ -124,7 +126,10 @@ class DigitalRain {
public:
DigitalRain() {
std::srand(0);
WIDTH = screen_width;
HEIGHT = screen_height + 5;
COLS = WIDTH / CHAR_WIDTH;
ROWS = (HEIGHT - MARGIN_TOP) / CHAR_HEIGHT;
for (uint8_t i = 0; i < MAX_DROPS; ++i) {
init_drop(i, true);
}