Libraries, utilities, bootloaders...
by Guicrith » Fri Jan 16, 2015 1:12 am
I cant find a print function in Display.cpp or Display.h so how does gb.display.print work
-
Guicrith
-
- Posts: 5
- Joined: Wed Jan 14, 2015 5:22 am
by Myndale » Fri Jan 16, 2015 2:43 am
Display inherits the Print class which is part of the Arduino core library. If you look at the header for the Print class (arduino-1.0.5\hardware\arduino\cores\arduino\Print.h) you'll see there's a pure virtual member for printing a single character which derived classes need to implement:
- Code: Select all
virtual size_t write(uint8_t) = 0;
And sure enough there's an implementation of this function in Gamebuino's Display class. By inheriting Print you get all the usual output features like println, formatted printing etc without having to implement all that functionality yourself.
More details here:
http://playground.arduino.cc/Code/Printclass
-
Myndale
-
- Posts: 507
- Joined: Sat Mar 01, 2014 1:25 am
Return to Software Development
Who is online
Users browsing this forum: No registered users and 7 guests