Hi,
has anyone successfully implemented vararg functions for CMD_BUTTON, CMD_TEXT and CMD_TOGGLE?
I am looking into implementing it for CMD_TEXT and I am sort of stuck at the beginning.
The problem is, there is no way to tell how many arguments are supplied and of what type these are.
So if I understand this correctly you either have to work with a known set or arguments like numbers for which
you also provide the amount with which you are calling the function.
void EVE_cmd_text_numbers(int16_t x0, int16_t y0, int16_t font, uint16_t options, const char* text, num,...)
EVE_cmd_text_numbers(0,0,28,OPT_FORMAT,"foo bar %x.i",2,0xdeadbeef,8);
This approach seems lacking.
The other alternative would be to parse the string.
But then I could use snprintf() before using EVE_cmd_text() and be done.
A practical approach would be a function that adds a single uint32_t parameter that is transferred only if OPT_FORMAT is given.
Well, better than nothing, I am adding this for now.