Switch to full style
Libraries, utilities, bootloaders...
Post a reply

Cant find gb.display.print

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

Re: Cant find gb.display.print

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:
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
Post a reply