-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnimatedChar.h
42 lines (37 loc) · 1.06 KB
/
AnimatedChar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
AnimatedChar.h - Library for animated characters.
Created by Pavel Milkevich, December 12, 2020.
*/
#ifndef _AnimatedChar_h
#define _AnimatedChar_h
#include "Arduino.h"
#include "gfxfont.h"
#include "Animation.h"
class AnimatedChar : AnimationListener {
public:
AnimatedChar();
AnimatedChar( const GFXfont* font );
AnimatedChar( const GFXfont* font, char ch );
Animation* getAnimation();
void setAnimation( Animation* animation );
void setPosition( int x, int y );
char getChar();
void animateTo( char ch );
void stopAnimation();
bool isAnimating();
void setVisible( bool visible );
void next();
void onAnimation( AnimationStatus status, char from, char to, byte progress );
protected:
virtual void printFrame( uint8_t* data ) = 0;
int _x = 0;
int _y = 0;
int _w = 0;
int _h = 0;
private:
bool _visible = true;
char _char;
Animation* _anim = nullptr;
GFXfont* _font;
};
#endif