I'm making a menu at the moment, and I need to find out how to accomplish two things.
How can I check if a certain flag is
included in a panel? For instance, if I set:
panel.flags = SHOW | OVERLAY;
if(panel.flags == SHOW) will be false regardless of whether SHOW is on or off, due to OVERLAY being on. How do I check if a certain flag is on, ignoring any other?
----------------------------------------------------
Also, I need a panel and a function to interact with each other. More specifically, the panel will have buttons that can activate the function, and the function might have to change the flags of the panel. This creates a problem of code order.
PANEL* superpanel={
button(blah,blah,superfunction);
}
function superfunction(){
superpanel.flags = SHOW;
}
superpanel doesn't know what superfunction is. I can fix this by putting this somewhere before the panel:
function superfunction(){}
...but I'm afraid that might be a very rough and hack-ish solution to this problem that may cause issues. Is this ok, or should I do something else?