RogerClark wrote: ↑
Thu Jun 22, 2017 1:18 am
david.prentice wrote: ↑
Wed Jun 21, 2017 3:28 pm
So I can expect tft.println("Hello World") to work just like Serial.println("Hello World");
Or tft.drawRect(0, 10, 5, 20, WHITE) to work like any other drawRect()
I doubt even if you always used libraries by the same company e.g. Adafruit, whether tft.println() would work the same across all their libs or whether it worked the same as Serial.println
From what I can tell, libs by the same company e.g. Adafruit are often written by different people and don't confirm to any style guide.
In my day job I use libs on various platforms from various sources, and they all behave differently
I think the only time you can expect the sort of coherence to a fixed API style and functionality is if you single source your SDK / API / Libs from one company as a commercial product e.g. All Apple iOS API's strongly follow a style, but this is a heavily funded commercial team.
Rubbish. If one class inherits from Print.h it will inherit all the Print.h methods.
This is a feature of C++ and most OO languages.
Yes, the new class can implement new methods. It can even overwrite some of the inherited methods. But as a general rule, you extend methods or add new methods rather than change behaviour.
e.g. you might add tft.blueCircle(x, y, radius) to draw a circle in blue.
e.g. it is possible that you overwrite the existing tft.drawCircle(x, y, radius, color) method to draw triangles. But extremely unlikely.
Yes, I suppose that a disgruntled Apple ex-employee might try to change the style.
So libraries that inherit from Adafruit_GFX are easy to use by existing Arduino owners.
It makes life easier for the library author too.
But any library can invent any new class with any named methods that do not follow any logical pattern.