Windows. Everything now is implemented in Windows. ;-) (Okay, just the drawing stuff. And defnititely nothing by Microsoft.)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
#include "Effect.h"
|
||||
#include "effect_big_clock.h"
|
||||
#include "text.h"
|
||||
#include "functions.h"
|
||||
#include "fonts.h"
|
||||
#include "ntp.h"
|
||||
|
||||
void BigClockEffect::drawNumber(uint8_t number, int x, int y, CRGB color) {
|
||||
@ -12,32 +11,13 @@ void BigClockEffect::drawNumber(uint8_t number, int x, int y, CRGB color) {
|
||||
|
||||
void BigClockEffect::drawText(char *text, int x, int y, CRGB color) {
|
||||
for (uint8_t i = 0; i < strlen(text); i++) {
|
||||
drawSprite(font_char(numbers4x7, text[i]), x + i * 4, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
const unsigned char* BigClockEffect::font_char(const unsigned char* font, char c) {
|
||||
return font + (c - 48) * 4;
|
||||
}
|
||||
|
||||
void BigClockEffect::drawSprite(const unsigned char* sprite, int xOffset, int yOffset, CRGB color) {
|
||||
for ( byte y = 0; y < 7; y++) {
|
||||
for ( byte x = 0; x < 4; x++) {
|
||||
bool on = (sprite[x] >> y & 1) * 255;
|
||||
if (on) {
|
||||
leds[ XYsafe(x + xOffset, y + yOffset) ] = color;
|
||||
}
|
||||
}
|
||||
window->drawChar(&font_numbers4x7, text[i], x + i * 4, y, &color);
|
||||
}
|
||||
}
|
||||
|
||||
void BigClockEffect::loop() {
|
||||
clear();
|
||||
window->clear();
|
||||
drawNumber(ntpClient.getHours(), 0, 0, color_h);
|
||||
drawNumber(ntpClient.getMinutes(), 8, 0, color_m);
|
||||
/*if (ntpClient.getSeconds() & 1) {
|
||||
leds[XYsafe(13, 2)] = color_colon;
|
||||
leds[XYsafe(13, 5)] = color_colon;
|
||||
}*/
|
||||
drawNumber(ntpClient.getSeconds(), 8, 8, color_colon);
|
||||
drawNumber(ntpClient.getSeconds(), 8, 8, color_colon);
|
||||
}
|
||||
|
Reference in New Issue
Block a user