This topic is now archived and is closed to further replies.


2D Engine/Wrapper creation

Recommended Posts

drdarkon    122
Hey everyone, Okay, so I have gotten my books on DirectDraw, read through Gaming Gurus DirectX sections and all that. Now I''m at the point where I am going to create a little wrapper sorta thing for all the stuff I need to do in a game I will make. I''m gonna make my wrapper similar to LaMothe''s. I''m not making my game off of his though because I think it would be a great learning experience to go through and create my own. I have already learned a whole bunch in the last 2 hours I have been working on it. Alrighty, now for my questions, I was wondering if you guys had any suggestions for creating a wrapper. You guys are all very experience so I was just checking to see if you have any pointers for me to follow. So far this is what I''m doing. I have a struct that is going to hold all the information for my sprites. The struct is Sprite and contains a RECT for its location, the surface it is on, its # of frames, speed the animations play, a BOOL that tests whether it is to be drawn... and more as I come up with more. I will be using 1 function to create each Sprite that gives it a surface and loads in the BMP to it. Blts it on the offscreen surface. I will have 1 function to initialize it and give it the coords it starts at. I will have 1 function that blts the Sprites current frame onto the destination surface at it''s location. Okay do you guys (or gals) have any suggestions that I could use? I could really use anything you have and it would be much appreciated. If you think an idea of mine is stupid or have a better way for me to do it let me know. Or, if you have just general guidelines I could follow, please, let me know Thankyou very much for your time - Jesse

Share this post

Link to post
Share on other sites
AdmiralBinary    100
One mistake I made when doing my wrapper - I put the current frame number in the animation class! (So when I drew lots of explosions on the screen, they all went at exactly the same speed and same frame!) I suggest having something like an AnimationHost class that contains the current frame of an animation as well as a pointer to the animation itself. Just a thought...

EDIT - WOW! A typo! By ME! Unthinkable...


I finally got it all together...
...and then forgot where I put it.

Edited by - AdmiralBinary on December 30, 2001 10:26:18 PM

Share this post

Link to post
Share on other sites