I hate my base code...

Started by
20 comments, last by Auron 19 years, 7 months ago
well, I know doom3's editor uses mfc as do most level editors out there (ued?). However, like said, .net will replace mfc in the near future. Anyway though, I need sleep! good night guys.
www.jinx.com www.thebroken.org www.suprnova.org www.mozilla.org
Advertisement
JD, nice work man!
www.jinx.com www.thebroken.org www.suprnova.org www.mozilla.org
If you want to "OO Win32", why not take a look at WTL, released as Open SOurce by Microsoft. It's essentially a thin OO wrapper for windows but it really helps simplify managing the GUI environment without the bloat and hassle that comes with MFC. You can find a load of tutorials for WFC on CodeProject.
Quote:Original post by yodaman
I have been using a windows/ogl base code I wrote for about 6 months but Im really not happy with it. Im just using the raw windows api, and deriving a class for the main loop functions.
Don't fix it until you're sure it's broken. If it merely offends your senses, suck it up and let it be. Spend your time writing new code instead of rewriting old code. :)

(if, on the other hand, it is making that new code hairy and gross, then it may save more time to dump it than it would to just stick with it)

Quote:Original post by Ainokea
SDL is written in c and not OO at all unlless you right a wrapper for it like I did.
Why is this a problem?

OO-izing SDL doesn't buy you anything. It's still the same old API, with all the strengths and flaws that come with it, except that you've aged a bunch of hours, and can use this.that() syntax. ;)

(besides, SDL is one of the clearest, most straightforward C APIs I know of. Using it is pretty painless)
"There is only one everything"
WTL is a good thing. It's a lot more lightweight than MFC and
straight in use. However it's not good documented (although there are some doc projects in the web) and you end up looking in the WTL source often.

Why not switching to C# where building a GUI is extremly easy and clear (and OO :) For tools I would strongly recommend it and it's a language which I belive has the future.

For your game engine it might be also the solution but there are some things like garbage collection that should be handled carefully if highly optimized code is required.

Give it a try!

-Constantin
I think the OS/2 Presentation Manager rocked! Damn that it is dead :(
Quote:Original post by Ainokea
SDL is written in c and not OO at all unlless you right a wrapper for it like I did.


Oh... my bad... I haven't used SDL in a good long while and completely forgot what it was like.

Quote:cavemanbob
I don't think I'd refer to MFC as being "hellish" to learn, but for the non-tools part of game development it's completely useless anyway, it's just not suited for the task at all. For applications it's a mature API that can do just about anything, though in the future it's going to be replaced by .NET.


If all you want it for is to set up a window to plunk your OpenGL stuff in and some controls to do some stuff, then I suppose the learning curve for MFC is lower than for Win32.

I was never debunking MFC's power. I know it can do just about anything, but I remember spending hours looking for help on really simple things that it couldn't seem to handle without severely butchering the boiler-plate code from MSVC.

-Auron
The good thing about MFC is that it has that message wizard thingy which you would have to replicate in win32 with callbacks or turn it into win32 OO. There is an article on gamedev how to do win32 the OO way. I've done it that way also but didn't like it. I wrote large codebase in win32 and seeing how painful that experience was I switched to MFC. When I switched I realized that MFC while wonderful with msg macros and such can be hard to use at first because you need to know MFC function invocation order so that you can interact with it. Some MFC objects aren't yet created when you think they should be or they pass in invalid window size, etc. Immediately, after switching to MFC from win32 I've noticed that the MFC widgets are much nicer looking. They add more decorations, etc.

You mentioned windows.ini file and if I understand you then you like to save some application properties into that file, correct? .ini files are considered obsolete and I use MFC windows registry functions to save my app data. However, I will probably move that into separate file so that the settings persist across installation/deinstallation of my app. Registry is wiped out each time the app is reinstalled.

I have not used WTL but my understanding is that it lacks some MFC functionality, just not sure which ones. Drag and drop?, etc.

MFC tip: try to keep some names short because MFC wizard dialog boxes in msvc6 IDE can't be resized and thus names won't be fully visible. Is this issue fixed in vc2003 IDE?
I think he was actually referring to using INI files in general. If not, then definitely use the registry. windows.ini is obsolete.

If you mean just using INI files in general, don't do that either. You could write your own parser and stuff, or find one online, but really, INI files are getting to be antiquated (at least in my opinion). Use XML files for configuration instead. There are libraries (like TinyXML) that will do most of the hard stuff for you.

-Auron
if you want to use ini files without any library, just to make it simple,
check out these functions:
http://msdn.microsoft.com/library/en-us/mslu/winprog/unicode_layer_ini_file_functions.asp
i made my ini class in 21 lines of code
pex.

This topic is closed to new replies.

Advertisement