This commit is contained in:
Bodmer 2021-05-11 21:38:26 +01:00
parent 612e76343e
commit 8164629397
2 changed files with 4 additions and 3 deletions

View File

@ -3,10 +3,11 @@
** Grabbed from Adafruit_GFX library and enhanced to handle any label font ** Grabbed from Adafruit_GFX library and enhanced to handle any label font
***************************************************************************************/ ***************************************************************************************/
TFT_eSPI_Button::TFT_eSPI_Button(void) { TFT_eSPI_Button::TFT_eSPI_Button(void) {
_gfx = 0; _gfx = nullptr;
_xd = 0; _xd = 0;
_yd = 0; _yd = 0;
_textdatum = MC_DATUM; _textdatum = MC_DATUM;
_label[9] = '\0';
} }
// Classic initButton() function: pass center & size // Classic initButton() function: pass center & size

View File

@ -10,7 +10,7 @@ class TFT_eSPI_Button {
public: public:
TFT_eSPI_Button(void); TFT_eSPI_Button(void);
// "Classic" initButton() uses center & size // "Classic" initButton() uses centre & size
void initButton(TFT_eSPI *gfx, int16_t x, int16_t y, void initButton(TFT_eSPI *gfx, int16_t x, int16_t y,
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
uint16_t textcolor, char *label, uint8_t textsize); uint16_t textcolor, char *label, uint8_t textsize);
@ -34,7 +34,7 @@ class TFT_eSPI_Button {
private: private:
TFT_eSPI *_gfx; TFT_eSPI *_gfx;
int16_t _x1, _y1; // Coordinates of top-left corner of button int16_t _x1, _y1; // Coordinates of top-left corner of button
int16_t _xd, _yd; // Button text datum offsets (wrt center of button) int16_t _xd, _yd; // Button text datum offsets (wrt centre of button)
uint16_t _w, _h; // Width and height of button uint16_t _w, _h; // Width and height of button
uint8_t _textsize, _textdatum; // Text size multiplier and text datum for button uint8_t _textsize, _textdatum; // Text size multiplier and text datum for button
uint16_t _outlinecolor, _fillcolor, _textcolor; uint16_t _outlinecolor, _fillcolor, _textcolor;