Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Are enumerators really necessary for changing functions?

Author
Message
spine
16
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 4th Jun 2009 06:28
I'm trying to make my own project keeping the Dark Invaders tutorial in mind, and I don't see any need for the enumerators that are used at the beginning of the program. So in addition to the topic question, If they are necessary, could someone tell me why?
ABXG
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Canada
Posted: 4th Jun 2009 10:36
You could easily just replace them with number codes, like #1 would display the main menu, #2 would be character creation, #3 would be loading a level, etc.

An enumerator essentially acts like an integer except you can give it an actual name. It is useful for making your code easier to follow. For example, you could replace the above with enumerators like "mainMenu", "createCharacter", "loadLevel".

------------------------------------
Currently 1500+ lines of code into an "over-the-shoulder" action RPG with combat based on rag-doll physics.

Login to post a reply

Server time is: 2024-11-05 23:05:15
Your offset time is: 2024-11-05 23:05:15