#include "ui.h" #include #include #include #include "colors.h" #include "util.h" const struct { const char *str; uint8_t weight; } splashes[] = { {"loading", 50}, {"performing astronomical calculations", 2}, {"doing rocket science", 2}, {"trying to remember if it's sohcahtoa or cohsahtoa", 2}, {"embiggening chicks", 2}, {"doing tons of basic addition", 2}, {"converting local to UTC", 2}, {"converting UTC to local", 2}, {"converting UTC to UTC", 2}, {"celestial bodies go brr", 1}, {"never gonna give you up", 1}, {"fake loading screens are dumb", 1}, {"But can it do this?", 1}, {"also try HappyCalc", 1}, {"java-free", 1}, {"product of Cemetech", 1}, {"your ad here", 1}, {"please imagine a pop-up ad here", 1}, {"why did i make this", 1}, {"65% feature-complete!", 1}, {"less secure than originally planned", 1}, {"procrastination, **** yeah", 1}, {"blame comic", 1}, {"\x02", 1}, {"perhaps", 1}, {"\"stand by for a phrase\" - womp", 1}, {"eh?", 1}, {"But nothing happened!", 1}, {"patients, young padawan", 1}, {"Now with extra localtime()", 1}, {"net weight 0 grams", 1}, {"tip: money can be exchanged for goods and services", 1}, {"not responsible for damages", 1}, {"not responsible in general", 1}, {"splash #14/36", 1}, }; const char *get_splash(void) { uint8_t total = 90; int8_t n = randInt(0, total - 1); uint8_t i = 0; while(n >= 0) { n -= splashes[i].weight; i++; } return splashes[i - 1].str; } void loading_screen(void) { gfx_FillScreen(BLACK); gfx_SetTextFGColor(WHITE); gfx_SetTextScale(3, 3); const char *title = "hot chicks"; gfx_PrintStringXY(title, (LCD_WIDTH - gfx_GetStringWidth(title)) / 2, LCD_HEIGHT / 3); gfx_SetTextScale(1, 1); const char *splash = get_splash(); gfx_PrintStringXY(splash, (LCD_WIDTH - gfx_GetStringWidth(splash)) / 2, LCD_HEIGHT * 2 / 3); gfx_BlitBuffer(); } void draw_overlay(time_t time, uint24_t days, bool too_hot, bool too_cold) { struct tm *t = localtime(&time); uint8_t hour = t->tm_hour; bool pm = false; if(hour > 11 && !is_clock_24h()) { pm = true; hour -= 12; } if(hour == 0) hour = 12; gfx_SetTextFGColor(WHITE); gfx_SetTextXY(20, 20); gfx_PrintUInt(hour, 1); gfx_PrintChar(':'); gfx_PrintUInt(t->tm_min, 2); gfx_PrintChar(' '); if(!is_clock_24h()) { if(pm) gfx_PrintString("PM"); else gfx_PrintString("AM"); } gfx_SetTextXY(20, 36); gfx_PrintUInt(days, 1); gfx_PrintString(" days"); // todo: get sprites for this gfx_SetTextXY(20, 52); if(too_hot) gfx_PrintString("TOO HOT"); if(too_cold) gfx_PrintString("TOO COLD"); }