So what is PixiGui
First and foremost it is a work in progress so if your looking for a fully functional library this is not it YET!
This requires a Mega minimum (will not work on a Uno).
I have chosen to post my code (proof of concept) here and now in the hope that the wisdom of the crowd will positively influence my project. So while I believe my design is sound I'll openly admit that I have been away from C++ for awhile and my code may not be as elegant as I would like. So all Constructive Criticism is Welcome.
I've followed the standard of including an 'Example' folder but in all honesty these are tests, so if you start at the start you may get way board before you see something worth looking at. So I suggest starting with 'MarginsAndAlign' and 'MovingImageButtons'. But I have to admit until I offer the full library this whole system may seem like a lot of effort for very little gain.
Under the bonnet..
Pixi controls are broken into 2 basic groups. Host and Element
As the names suggest a host can contain other controls (including other hosts) so hosts are also elements..
While a pure element control is a base unit that simply does what it does and must be contained within a host.
All parameters regarding location and alignment of a control are relevant to their host not the screen..
At the moment we have.
Host:
Page
NavPage (not functional)
Border
StackPanel
Element:
TextBlock
Button
TextButton
ImageButton
And that's it (for proof of concept)
But now that the core concepts have been solved the inclusion of
TextBox (input that requires a keyboard)
ToggleButton
Checkbox
Switch
Slider
Menu etc.
are not to far behind.
PixiGui works on a 4 pass system.
-
Measure. All controls are given a maximum space that they can occupy and are required to respond with the space they will require.
-
Layout. Having given the parent control their space requirements a control is now given it's allocated space and a co-ordinate in which to operate.
-
Erase. At this point each control is given the chance to erase from the screen any unwanted artefacts of previous renders.
-
Render. Now knowing it's available space and location a control can draw itself to the screen.
Notes
** The 'Read Me" files are very limited at this point.
** At the moment this is aimed at a 320 x 240 TFT LCD and uses the MCUFRIEND_kbv library.
** This has only been tested on a 8 bit parallel system (no SPI) but should work? maybe? With required pin changes. (look in the GUI.h file for Touchscreen)
I have taken and learnt so much from the free programming community over the last decade, and it's time to give back.
Dan B
Pixi.zip (41.3 KB)