Files
Flipdot-display/src/esp32/logic/builtin_pages.cpp
T

45 lines
965 B
C++
Raw Normal View History

#include "logic/builtin_pages.h"
#include <string.h>
#include "logic/builtin_fonts.h"
static const char *const NAMES[] = {BUILTIN_PAGE_CLOCK};
int builtinPageCount()
{
return sizeof(NAMES) / sizeof(NAMES[0]);
}
const char *builtinPageName(int index)
{
return index >= 0 && index < builtinPageCount() ? NAMES[index] : nullptr;
}
static void clockPage(DynamicPage &page)
{
page = DynamicPage();
page.slot_count = 2;
page.slots[0].start = 0;
strcpy(page.slots[0].bitmap, "Pikachu");
page.slots[1].start = 17 * 60;
strcpy(page.slots[1].bitmap, "Pikachu yawning");
// The same spot as the old clock: in the thought bubble
page.element_count = 1;
PageElement &clock = page.elements[0];
clock.type = ElementType::Clock;
clock.x = 46;
clock.y = 4;
strcpy(clock.font, FONT_NORMAL_NAME);
}
bool builtinPage(const char *name, DynamicPage &page)
{
if (name && sameName(name, BUILTIN_PAGE_CLOCK))
{
clockPage(page);
return true;
}
return false;
}