added the WANT_ABSTRACTS define so the library works with text sizes greater than 1
Fork of Adafruit_GFX by
Revision 4:232e3d1d47bc, committed 2014-10-12
- Comitter:
- danielashercohen
- Date:
- Sun Oct 12 04:42:13 2014 +0000
- Parent:
- 3:969ca9fe5e2b
- Commit message:
- added a define for WANT_ABSTRACTS because without that the library will only work with a text size of 1
Changed in this revision
diff -r 969ca9fe5e2b -r 232e3d1d47bc Adafruit_GFX.cpp --- a/Adafruit_GFX.cpp Wed Jan 23 02:43:38 2013 +0000 +++ b/Adafruit_GFX.cpp Sun Oct 12 04:42:13 2014 +0000 @@ -368,8 +368,9 @@ cursor_y += textsize*8; cursor_x = 0; } - else if (c == '\r') - cursor_x = 0; + else if (c == '\r') { + // cursor_x = 0; + } else { drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize); @@ -383,6 +384,8 @@ return 1; } + + // draw a character void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size) { @@ -410,23 +413,27 @@ if (size == 1) // default size drawPixel(x+i, y+j, color); #ifdef WANT_ABSTRACTS - else // big size + else { // big size fillRect(x+(i*size), y+(j*size), size, size, color); #endif + } } else if (bg != color) { if (size == 1) // default size drawPixel(x+i, y+j, bg); #ifdef WANT_ABSTRACTS - else // big size + else {// big size fillRect(x+i*size, y+j*size, size, size, bg); -#endif +#endif + } } line >>= 1; } } } + + void Adafruit_GFX::setRotation(uint8_t x) { x %= 4; // cant be higher than 3
diff -r 969ca9fe5e2b -r 232e3d1d47bc Adafruit_GFX.h --- a/Adafruit_GFX.h Wed Jan 23 02:43:38 2013 +0000 +++ b/Adafruit_GFX.h Sun Oct 12 04:42:13 2014 +0000 @@ -35,6 +35,9 @@ #define BLACK 0 #define WHITE 1 +// The WANT_AVSTRACTS define allows text sizes other than 1 to be selected +#define WANT_ABSTRACTS + class Adafruit_GFX : public Stream { public: @@ -96,7 +99,7 @@ void setTextWrap(bool w) { wrap = w; }; void setRotation(uint8_t r); - uint8_t getRotation(void) { rotation %= 4; return rotation; }; + uint8_t getRotation(void) { rotation %= 4; return rotation; }; protected: int16_t _rawWidth, _rawHeight; // this is the 'raw' display w/h - never changes
diff -r 969ca9fe5e2b -r 232e3d1d47bc Adafruit_SSD1306.h --- a/Adafruit_SSD1306.h Wed Jan 23 02:43:38 2013 +0000 +++ b/Adafruit_SSD1306.h Sun Oct 12 04:42:13 2014 +0000 @@ -41,8 +41,8 @@ appropriate size -----------------------------------------------------------------------*/ -//#define SSD1306_128_64 -#define SSD1306_128_32 +#define SSD1306_128_64 +// #define SSD1306_128_32 /*=========================================================================*/ #if defined SSD1306_128_64 && defined SSD1306_128_32