BRT Community

General Category => Discussion - EVE => Topic started by: vdc on July 06, 2022, 03:19:55 PM

Title: Monochrome Button
Post by: vdc on July 06, 2022, 03:19:55 PM
Hi,

Is there anyway I can draw a monochrome button and assign TAG as picture I attached with CMD_BUTTON?

I'm working on replicate the screen from Monochrome display. I can make a MUTE button with CMD_BUTTON, but I can't create a NEXT button. I want to use CMD_BUTTON because I want to use TAG on each button.

is there any way I can make this?

Best regards,
Title: Re: Monochrome Button
Post by: BRT Community on July 06, 2022, 04:29:24 PM
Hello,

Thank you for your question.

Firstly i would note that it is possible to use the TAG functionality on any item placed on the screen, normally we would recommend users look at utilising bitmaps to represent custom buttons if they have a desired button aesthetic they are trying to achieve. This normally requires generating a bitmap which contains both 'pressed' and 'unpressed' versions of the button, this can be placed on screen and tagged as normal, when a touch is detected in the tagged area you can update the display list to show the pressed/un-pressed button accordingly. This method may be more applicable to what you are trying to achieve in regards to monochrome buttons.

Alternatively if you wish to continue utilising the inbuilt CMD_BUTTON, you can use the CMD_FGCOLOR function to colour the main button component and then utilise the LINES primitives to add the button edges, see attached for a quick example and below for the code used:

Code: [Select]
CLEAR(1, 1, 1)
COLOR_RGB(255, 255, 127)
CMD_FGCOLOR(0x000000)
CMD_BUTTON(316, 266, 120, 36, 27, 0, "Mute")
BEGIN(LINES)
VERTEX2F(5056, 4240)
VERTEX2F(5056, 4816)
VERTEX2F(5056, 4816)
VERTEX2F(6976, 4816)
VERTEX2F(6976, 4816)
VERTEX2F(6976, 4240)
VERTEX2F(6976, 4240)
VERTEX2F(5056, 4240)
END()

Best Regards,
BRT Community
Title: Re: Monochrome Button
Post by: Rudolph on July 06, 2022, 10:43:38 PM
For simple buttons I just use rectangles with text on them and change the color when pressed.
And by changing the line-width you can have rectangles with rounded corners.

For EVE Screen Editor:
CLEAR(1, 1, 1)
TAG(100)
LINE_WIDTH(100)
BEGIN(RECTS)
COLOR_RGB(255,255,100)
VERTEX2F(3376, 2896)
VERTEX2F(5264, 3776)
END()
COLOR_RGB(0,0,0)
CMD_TEXT(223, 195, 28, 0, "My Button")
TAG(0)

Title: Re: Monochrome Button
Post by: vdc on July 11, 2022, 04:34:37 PM
Hi Rudolph,

I do another way that draw a bigger gold color button and then draw a smaller black color button inside and it still works.

Which one is more effective? Two buttons OR Rects and Button?

Best regards,
Title: Re: Monochrome Button
Post by: BRT Community on July 12, 2022, 11:15:56 AM
Hello,

Utilising two CMD_BUTTON widgets will result is  more RAM_DL usage than Rudolph's method for a simple button, if RAM_DL usage is a concern in your application I would consider the RECTS approach.

Best Regards,
BRT Community 
Title: Re: Monochrome Button
Post by: Rudolph on July 12, 2022, 04:28:21 PM
Yes, I regulary use two rects over each other to draw frames.
An alternative would be using LINE_STRIP, but then the width of the frame depends on LINE_WIDTH so you can't have rounded corners and thin frames with LINE_STRIP.

Try this in EVE Screen Editor:

Code: [Select]
CLEAR_COLOR_RGB(0,0,0)
CLEAR(1, 1, 1)
LINE_WIDTH(80)
BEGIN(RECTS)
COLOR_RGB(255,215,0)
TAG(100)
VERTEX2F(1600, 1600)
VERTEX2F(3200, 2240)
TAG(110)
VERTEX2F(1600, 2560)
VERTEX2F(3200, 3200)
COLOR_RGB(0,0,0)
TAG(110)
VERTEX2F(1632, 2592)
VERTEX2F(3168, 3168)
END()
TAG(100)
COLOR_RGB(0,0,0)
CMD_TEXT(150, 120, 28, OPT_CENTER, "MUTE")
TAG(110)
COLOR_RGB(255,215,0)
CMD_TEXT(150, 180, 28, OPT_CENTER, "NEXT")
TAG(0)

As for efficiency, this sequence uses 38 32bit words on the display-list.
The only way to get away with less would be to use images for the buttons.
In contrast, a single FLAT button with the text "MUTE" uses 16 or 20 32bit words, depending on the posistion of the screen, just the button without TAG or color commands.

Doing this in discrete commands also allows to split the display list in a part that is static and therefore only needs to be transferred once (see CMD_APPEND) and the part that is transferred for every refresh because it changes.

In this example the first rectangles could be moved to the static section.

You could easily add visual feedback to this by for example not drawing the second
rectangle when the button is touched and changing the color of the text to black.
Title: Re: Monochrome Button
Post by: vdc on October 03, 2022, 12:53:06 AM
Hi Rudolph,

How do you count the numbers of sequence  use in this. I can only count up to 31, how it is 38?

Thanks,

Yes, I regulary use two rects over each other to draw frames.
An alternative would be using LINE_STRIP, but then the width of the frame depends on LINE_WIDTH so you can't have rounded corners and thin frames with LINE_STRIP.

Try this in EVE Screen Editor:

Code: [Select]
CLEAR_COLOR_RGB(0,0,0)
CLEAR(1, 1, 1)
LINE_WIDTH(80)
BEGIN(RECTS)
COLOR_RGB(255,215,0)
TAG(100)
VERTEX2F(1600, 1600)
VERTEX2F(3200, 2240)
TAG(110)
VERTEX2F(1600, 2560)
VERTEX2F(3200, 3200)
COLOR_RGB(0,0,0)
TAG(110)
VERTEX2F(1632, 2592)
VERTEX2F(3168, 3168)
END()
TAG(100)
COLOR_RGB(0,0,0)
CMD_TEXT(150, 120, 28, OPT_CENTER, "MUTE")
TAG(110)
COLOR_RGB(255,215,0)
CMD_TEXT(150, 180, 28, OPT_CENTER, "NEXT")
TAG(0)

As for efficiency, this sequence uses 38 32bit words on the display-list.
The only way to get away with less would be to use images for the buttons.
In contrast, a single FLAT button with the text "MUTE" uses 16 or 20 32bit words, depending on the posistion of the screen, just the button without TAG or color commands.

Doing this in discrete commands also allows to split the display list in a part that is static and therefore only needs to be transferred once (see CMD_APPEND) and the part that is transferred for every refresh because it changes.

In this example the first rectangles could be moved to the static section.

You could easily add visual feedback to this by for example not drawing the second
rectangle when the button is touched and changing the color of the text to black.
Title: Re: Monochrome Button
Post by: Rudolph on October 04, 2022, 04:37:49 PM
You are correct, this is 31 one 32bit words, not 38, 21 one for all the simple commands and five each for the two CMD_TEXT.
Fortunately this makes it even more efficient compared to CMD_BUTTON.
And technically the first two commands do not belong in this sequence.