2020-06-12 04:15 AM
Hello,
I want to add to my project some level indicator like battery level, wifi level, gsm signal rssi level etc.
Is there a way to do it with touchgfx without add an image for each level?
2020-06-12 04:33 AM
Sure, if you think about it - You could have a "foreground" image that has full alpha for the parts of the image where the levels are supposed to be. Then, behind that image, you'll move a simple "Box" up, or sideways, or however you want it to fill those holds, letting the Box become visible where because of the alpha in the image on top.
Imagine this pseudo code for a battery gauge with "levels".
batteryLevel.increase(1);
..
Battery::init()
{
//define box
add(box);
//define top bitmap with alpha
add(top);
}
Battery::increase(uint8_t _level)
{
box.moveRelative(box.getX(), -20 * level); //Moves image up, 20px = 1 level.
}
You could do a battery indicator that is just a linear gauge too. Lots of options.
/Martin
2020-06-12 04:34 AM
It is not clear. Is there a guide or something like that?
2020-06-12 04:42 AM
This is just application development - You have to sort of envision the possibilities since it's impossible for us to cover every possible scenario (both in terms of widgets and guides). Start by sharing some graphics that show how you want these indicators to look and i'll point you in the right direction :)
/Martin