A first port of the excellent Adafruit GFX library
Revision 1:e67555532f16, committed 2013-08-15
- Comitter:
- SomeRandomBloke
- Date:
- Thu Aug 15 13:26:47 2013 +0000
- Parent:
- 0:08cfbae05724
- Child:
- 2:a7d4ac7ed08a
- Commit message:
- updates to latest constructor and fixed char issue
Changed in this revision
Adafruit_GFX.cpp | Show annotated file Show diff for this revision Revisions of this file |
Adafruit_GFX.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Adafruit_GFX.cpp Tue Mar 26 23:08:53 2013 +0000 +++ b/Adafruit_GFX.cpp Thu Aug 15 13:26:47 2013 +0000 @@ -17,9 +17,10 @@ #include "Adafruit_GFX.h" #include "glcdfont.h" -void Adafruit_GFX::constructor(int16_t w, int16_t h) { - _width = WIDTH = w; - _height = HEIGHT = h; +Adafruit_GFX::Adafruit_GFX(int16_t w, int16_t h): WIDTH(w), HEIGHT(h) { + + _width = WIDTH; + _height = HEIGHT; rotation = 0; cursor_y = cursor_x = 0; @@ -347,7 +348,6 @@ } int Adafruit_GFX::_putc(int c) { -//#endif if (c == '\n') { cursor_y += textsize*8; cursor_x = 0; @@ -374,7 +374,7 @@ if((x >= _width) || // Clip right (y >= _height) || // Clip bottom - ((x + 5 * size - 1) < 0) || // Clip left + ((x + 6 * size - 1) < 0) || // Clip left ((y + 8 * size - 1) < 0)) // Clip top return;
--- a/Adafruit_GFX.h Tue Mar 26 23:08:53 2013 +0000 +++ b/Adafruit_GFX.h Thu Aug 15 13:26:47 2013 +0000 @@ -23,15 +23,14 @@ #define swap(a, b) { int16_t t = a; a = b; b = t; } #define boolean bool -class Adafruit_GFX - : public Stream -// : public Print +class Adafruit_GFX : public Stream { public: //Adafruit_GFX(); + Adafruit_GFX(int16_t w, int16_t h); // Constructor // i have no idea why we have to formally call the constructor. kinda sux - void constructor(int16_t w, int16_t h); + //void constructor(int16_t w, int16_t h); virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; virtual void invertDisplay(boolean i); @@ -76,7 +75,7 @@ virtual int _putc(int value); virtual int _getc(); - int16_t WIDTH, HEIGHT; // this is the 'raw' display w/h - never changes + const int16_t WIDTH, HEIGHT; // this is the 'raw' display w/h - never changes int16_t _width, _height; // dependent on rotation int16_t cursor_x, cursor_y; uint16_t textcolor, textbgcolor;