olikraus / u8glib

Arduino Monochrom Graphics Library for LCDs and OLEDs
https://github.com/olikraus/u8glib/wiki
Other
1.25k stars 314 forks source link

Pass u8glib element to external class constructor #374

Closed cunidev closed 8 years ago

cunidev commented 8 years ago

Hello, I've been using this library for months, congratulations! However, now I have a doubt:

Is it possible to pass an initialized u8glib object to an external library? Which kind of object should I pass? Thanks

What I mean is:

file A contains the main program, with an u8glib element used to draw on the display. However, when it needs to print a dialog window it calls an external library, in file B, with constructor myUILibrary(u8g_element, display_width, display_height...). How should the u8g_element be passed?

Thank you!

olikraus commented 8 years ago

The parent class name is U8GLIB. This means the prototype of myUILibrary should be: myUILibrary(U8GLIB &u8g_element, display_width, ... In this case you can pass the object u8g directly.

Oliver

cunidev commented 8 years ago

Thank you very much! We can now close this issue :)