Skip to main content
GameDev.net gamedev.net
🔒 Locked

Your view on default values

Started by Programmer16 Apr 26, 2004 at 12:56 PM 5 replies 400+ views
Original Post
Programmer16
Programmer16
I''m making my game engine classes and was wondering how everybody feels about default values? Like, by default I''m thinking of setting the window''s WIDTHxHEIGHT to 800x600 and setting it to fullscreen. I was just wondering, thanks /* I use DirectX 9 and C++ (Microsoft Visual C++ 6.0 Professional edition) */
SantaClaws
SantaClaws
I don''t see a problem with it as long as you support saving the user''s settings, so the next time it starts it defaults to what they chose. Having the ability to edit the defaults the first time it starts might be nice, too, but I don''t think it''s really necessary.
Programmer16
Programmer16
Even though that's not what I meant, it helps me. I meant default values for a game engine's functions (
i.e. Window(HINSTANCE hInst, char* pTitle, int iWidth = 800, int iHeight = 600, bool bFullscreen = true); 
) Thanks.

PS: Another question thats off topic:
Does anybody see a problem in just supplying the width and dividing that by 1.3333333333333333333333333333333. Nevermind, I see the problem with doing this (different ratios for the screen)).

/*
I use DirectX 9 and C++ (Microsoft Visual C++ 6.0 Professional edition)
*/

[edited by - Programmer16 on April 26, 2004 2:08:08 PM]
Agony
Agony
Not all monitors are 4:3. Some are 5:4, some are 16:9, etc. For the most flexible design, stick with both width and height. In fact, I haven''t thought about it too hard, but you may have to deal with the fact that not all resolutions/monitors have square pixels. For example, on typical TVs, although the screen is 4:3, the resolution is 720x480, 3:2. So you might need to have width, height, and ratio.


Most of the greatest evils that man has inflicted upon man have come through people feeling quite certain about something which, in fact, was false.

-Bertrand Russell, Unpopular Essays, "Ideas That Have Harmed Mankind"
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o
Programmer16
Programmer16
Yeah, I already realized that, but as for the TV, I only plan on it being used on computers, but that info will be helpful in the future. Thanks

/*
I use DirectX 9 and C++ (Microsoft Visual C++ 6.0 Professional edition)
*/
WildWest
WildWest
When they are chosen well, they help to make coding easier without thinking everytime about all possible values of a function.

The Wild Wild West - Desperado!
The Wild Wild West - Desperado!
SantaClaws
SantaClaws
Oh, sorry, I misunderstood.

What I said still holds true, in one sense, however. I do use default parameters for functions like setVideoMode in my own engine, but I set them to an invalid value (like -1 for the width and height), and when I detect that, I set the default value to the one loaded from the configuration file. In a sense, supplying no value means use the one the user set, and I use the variables to override the configuration values if needed.

That doesn''t make sense in all instances, but where it does I think it''s much more useful than hard-coded default values.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.