Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, bigsmack, 7th_zorro, dr_panther), 1,364 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
If flag included, and interaction between a function and panel. #404081
07/02/12 09:30
07/02/12 09:30
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
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.
Code:
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:
Code:
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?

Last edited by Valdsator; 07/02/12 09:32.
Re: If flag included, and interaction between a function and panel. [Re: Valdsator] #404083
07/02/12 09:51
07/02/12 09:51
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
1 . (panel->flags & SHOW) == SHOW;
or
is(panel, SHOW); // Macro defined in gs

2. Don't worry, it is the right way to do it laugh (define your functions headers before you main function and implement them later). You can separate function headers and implementations in many files

Best regards.

Re: If flag included, and interaction between a function and panel. [Re: 3dgs_snake] #404085
07/02/12 10:10
07/02/12 10:10
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Awesome, thank you!

Edit: Would just like to mention that it seems panels don't care about whether they're defined before or after functions that they might have to call, so pre-defining them isn't required. But, knowing how to do this will definitely be helpful in the future. laugh

Last edited by Valdsator; 07/02/12 10:23.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1