2 ms·
Two label that should have the same value are normally one too many, but if they are needed it is often possible to order them properly... //initialization
by HelloNurse 6y ago
Two label that should have the same value are normally one too many, but if they are needed it is often possible to order them properly...
//initialization
int counter=0;
//each frame
label("count: %d\n", counter);
label("count again, in case you missed the other label: %d\n", counter);
if(button("increase")) { counter += 1; }
or, if the order of widgets is constrained, to buffer values:
//initialization
int counter_old=0;
int counter_new=0;
//each frame
counter_old = counter_new;
label("count: %d\n", counter_old);
if(button("increase")) { counter_new = counter_old+1; }
if(button("decrease")) { counter_new = counter_old-1; }
label("count again, in case you missed the other label: %d\n", counter_old);
- malkia 6y agoSo this is complexity you normally don't need with other UI approaches. And now would become a "pattern" that needs to be followed.