Just one question
Hi,
I think this is propably the last of my short and dumb questions (sorry to waste your time).
What is an enum?
I see that Half-Life''s SDK uses it alot to do model animations, like lets say the model is a hand with a pistol, and the animation is shooting, then it propably looks like this:
enum HGun
{
idle = 0;
shooting;
};
Well atleast thats how I think it is.
Well thanks for reading
----------=Last Attacker=----------
ICQ: 120585863
E-mail: laextr@icqmail.com
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
July 12, 2001 05:32 PM
An enum is basically an integer type. So using your example,
idle == 0
shooting == 1
Enums will automatically number themselves incrementally, unless you assign something. Enums are like #defines but better.
BTW, your example should be:
enum HGun
{
idle = 0, // separate with commas
shooting
};
enum is short for enumeration, which is what it does 
It takes the identifiers that you pass between the { } and assigns them values incrementally. By default the first value is 0, but you can set what you want it to start with by using the = on the first identifier.
The reason they are so handy is that you can be certain that none of the identifiers will have the same value. Whereas with #defines a missed key or bad memory (yours not the computers) when modifying things can cause a bug that is hard to find even if you are staring it in the face for an hour. lol
Seeya
Krippy

It takes the identifiers that you pass between the { } and assigns them values incrementally. By default the first value is 0, but you can set what you want it to start with by using the = on the first identifier.
The reason they are so handy is that you can be certain that none of the identifiers will have the same value. Whereas with #defines a missed key or bad memory (yours not the computers) when modifying things can cause a bug that is hard to find even if you are staring it in the face for an hour. lol
Seeya
Krippy
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement