cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX Level Indicator

yldzmuhammed
Associate III

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?

3 REPLIES 3
Martin KJELDSEN
Chief III

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

yldzmuhammed
Associate III

It is not clear. Is there a guide or something like that?

Martin KJELDSEN
Chief III

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