Jump to content
  • Advertisement
Sign in to follow this  
CodeBoy504

best way to handle program defaults

This topic is 4329 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 right now i'm working on an editor tool for a game. I'm still working on the design for it but I have come across the question of what to do about program defaults. For example, when creating a window in win32 you must give it an initial position, size, title, etc. It might just be a trivial thing but should these values be hardcoded into the program or should I load them from file such as a .ini file. I like the idea of loading from file because if they are loaded from file I could also save them when the program quits so the user can keep the same prefered settings. If the values were "hardcoded" into the program it would start up with these same defaults every time. How do most programs handle this? and what are some different ways I can do it?

Share this post


Link to post
Share on other sites
Advertisement
How about just creating a class to handle this and serialize it so it can be read in when the program starts and saved when the program exits?

The best option though would probably be to use the registry to hold these preferences because I think that's what it is designed for (I'm no expert on the registry though so maybe someone can add to this.)

Share this post


Link to post
Share on other sites
You should also consider what kind of user settings make sense for an editor. I would not consider window positioning to be one of them [smile]. For this specific case I would suggest using CW_USEDEFAULT for the x and y positions and let Windows decide for you.

As for other settings, loading them from a configuration file or the registry sounds like a good idea.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!