Sign in to follow this  

DWORD and usages for passing params

This topic is 3628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok i hope this comes as a simple question i am writing my own GUI Still .... anyways i wanted to use a DWORD varable to pass paramaters through as to shorten and make the setup calls to make a button edit box and so on easyer. Example.
#define GUI_SHOW 0x809 //Used as a flag to the Gui's show state true
#define GUI_DISABLED 0x810 //Used as a flag to the Gui's Enabled State

void SetOption(DWORD Options)
{
//To do 
}


Now the real problem here and what i can not figure out is if you were to pass in more then one parameter through SetOption() how could i separate them and how would i check for each one individually ! This is a very simple version of a much grander schema but for the most part using the DWORD to pass in an number of predefined sets would be very usefull and shorten setup protoypes greatly. Thanks for your time Regards Jouei.

Share this post


Link to post
Share on other sites
ahh thank you i did not think it would be complicated but for the life of me i could not get it lol.

Thanks and regards Jouei.

Share this post


Link to post
Share on other sites
hi,

a DWORD has a size of 32-bit.
maybe take a look at a 4 bit broad variable:

0010

you have 4 bits, and each of them can represent a boolean state.
with 32 bit you can now represent 32 different boolean state variables.

now you need to know how to "define" states, set states and check
if a state is set.
therefore there exist bitwise operations: AND, OR, XOR, SHIFT LEFT (SHL).

a good introduction is here:
http://www.gamedev.net/reference/articles/article1563.asp

have phun, shrooms

Share this post


Link to post
Share on other sites

This topic is 3628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this