Files
Flipdot-display/src/esp32/display/page_resources.cpp
T

48 lines
1.0 KiB
C++
Raw Normal View History

#include "display/page_resources.h"
#include <Arduino.h>
#include "display/bitmap_store.h"
#include "display/font_store.h"
#include "display/icon_store.h"
2026-10-20 17:52:25 +02:00
#include "display/life_player.h"
#include "net/ha_api.h"
Stopwatch stopwatch;
StoredPageResources pageResources(stopwatch);
bool StoredPageResources::background(const char *name, uint8_t *bitmap)
{
if (loadBitmap(name, bitmap))
return true;
Icon icon;
if (!loadIcon(name, icon))
return false;
iconToBitmap(icon, bitmap); // at the top left: images are drawn from their x, y
return true;
}
Font StoredPageResources::font(const char *name)
{
return findFont(name);
}
const char *StoredPageResources::haValue(const PageElement &element)
{
return haApiValue(element.entity, element.attribute);
}
uint32_t StoredPageResources::stopwatchMs()
{
return _stopwatch.elapsed(millis());
}
bool StoredPageResources::stopwatchRunning()
{
return _stopwatch.running();
}
2026-10-20 17:52:25 +02:00
const LifeRunner *StoredPageResources::life(const PageElement &element)
{
return lifePlayer.runner(element);
}