My Game Engine
We'll I've been working pretty hard on a 2D game engine in DirectX. I think it is coming along well. I want to know what you experts on C++ and Windows think about it, what should I add, what should I fix? So far its has 2d graphics, can play midi, wav, and mp3 music, and uses direct input mouse and keyboard. I am also going to add online capabilities to it, but before that I want to know things I need to make better and change so I dont get in over my head. Thanks for looking at it!
i completely forgot to say where it is, you can find it at http://shadowarts.ath.cx/projects/gecko/index.php
well i guess no one cares, i was just hoping someone would look at it and give me advice on what else today, ill go back to my cave then :(
I sit on this forum pressing F5 all day.
I attempted to compile your code, and I got a bijillion linker errors. I didn't have the patience to fix them, but it looks like directx linker errors.
Your OnIdle() function is crazy. You have a lot of checks in there that seem a bit excessive. I didnt take the time to read it all yet, but I will continue to look it over, but just from glancing over it, what are all those checks used for??
Also, I see a lot of inefficencies within your code. It seems you do a LOT of if checks and crazy checks all the time. Try to find a more efficient way to check all that information and your code will potentially run a lot smoother (not sure how it runs, couldnt run it).
One last recommendation, if you want people to read your code and not complain, definately set up a commenting standard for yourself and use it. Explain what the code does and how it works within the headers and it will make other peoples life a lot easier.
Hope these few things can potentially help you in your work. Let me know if you have any specific questions
well you have to include the directx libraries, some of the error checks were from debugging but i know what you mean , like i could remove this section the parts checking DDraw.lppdsPrimary and bActive, because I have new code to handle those , mose of my class funtions check for nulls because I am planning on this being reused by others and I want to stop fatal errors. The onIdle is a bit crazy, it is all testing code but I do need to work on a bit of a cleanup before I start anything else new . I haven't noticed any performace issues though.
What libraries (*.lib) did you add to the project. I'm especially looking for the DirectShow lib, since I can't find anything similar to DShow.lib in the SDK folder.
Oh, never mind. Found it - strmiids.lib.
Another thing. Doesn't these objects need to be released when exiting the program? I saw no such thing in your code.
the classes have them, i created a ::Destroy for all of the classes has the ->Release() funtion in them. The WM_CLOSE message on the MainWindowProc calls these when the program is quitting
lol, the : and D in ::Destroy made a simlie
But the DirectShow object (mp3 player) doesn't have one. I checked the DX docs, and there doesn't seem to be any release methods for it either. I just wanted to be sure I don't have any memory leaks ^^.
actually, its there.... look at the code in CDShow.cpp Line 140-150 its reads this:
Um, CDShow.cpp only has 137 lines. You must've uploaded an older version, or updated it after I downloaded it. Download the attachment and check (I tried now, but the host is down).
Anyway, I'll add the snippet you posted. Thanks for posting this engine anyway, it has been an inspiration ^^. Didn't know it would be this easy to play Mp3's (or wavs or mids for that matter) with DirectShow.
when i first went to do it i thought it would be one of the hardest parts, but it turned out to be very easy