sbrin / lopaka

Lopaka - Stunning graphics for embedded systems displays
https://lopaka.app
Apache License 2.0
315 stars 18 forks source link

Separate different code parts with (explaining) comments, group similar operations together #133

Closed Gaai closed 1 month ago

Gaai commented 4 months ago

Would be nice if the bitmap arrays, settings (like setFontMode) and different draw operations (string, line, xbm), would be seperated/grouped together in code, possibly with some explanatory comments. New users might not know the purpose of certain settings for example... Also why not have a short explanation of each function / bitmap array memory footprint/settings in a comment block. Seems like a nice gesture ;)

minimal:

// Set solid (0) or transparent (1) background mode
u8g2.setBitmapMode(1);
u8g2.setFontMode(1);

// Draw text
...

// Draw images: 
...

Function explanation example:

/* IMAGES
   u8g2_DrawXBM(*u8g2-structure, x-position, y-position, width-bitmap, height-bitmap, *bitmap-array);
*/
...

For arduino it might be nice to add the memory footprint of a bitmap array.

sbrin commented 4 months ago

I like it!

sbrin commented 4 months ago

The problem is when there are many layers it will be all littered with comments.

If we group layers by type then we break it's order. Which affects the resulting output.

Easiest solution can be a tutorial page where people can learn the basics.

Another option is to output such comments only for the first appearance of layer of specific type.

Gaai commented 4 months ago

Good points. Yes the order could matter of course. I'll think about it. It can also be an option like the wrapper function perhaps.

And more in the future, when there is a 'grouping' tool, which would be helpful, like aligning. It could help with organizing code layout.