Archived

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

Loading a Gif with DirectDraw

This topic is 5769 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

Can some one please explain to me were I can find some sort of tutorial on Loading Gifs!I''v tried looking all over Google and found nothing. I want to load Gif files to my offscreen DirecrDraw surefaces. Werre can I find some info on how to do this?

Share this post


Link to post
Share on other sites
The GIF format is patented and I''m not quite sure what the conditions of its use are... if you read them, you may be infringing the copyright, but I''m not sure. It could be you''re allowed to read them but not write them... well anyway, the choice is yours.

www.wotsit.org is an excellent site for information on file formats. There are many on loading GIF images, some of which include source code.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
Actually I haven''t got any of them loaded and played with them yet. I just wanted to know how to get them into a DirectDraw offscreen surface. I was going to use them because there small and don''t take up much space. I was alos going to use them like you would a BMP. Meaning when you make a bunch of little frames and then blit though little frames instead of the whole GIF. Is there realy that much difference in a 256 color BMP and a 256 GIF as in size and functionality? If not I''ll just ditch this topic and stick with BMPs. Sence there more MS compatible any ways.

Share this post


Link to post
Share on other sites
I would stick bmps. Though with a GIF editor, you could extract the individual frames and and save them as bmps. I have been recently looking into the jpg format. I would think it would come in handy in a graphics intensive application due to better compression. The bmp could take up a fair amount of space if uncompressed. You might also look into RLE encoding. That works best for simple graphics that do not have too many colours.

Guy

Share this post


Link to post
Share on other sites
Well thanks for your help. I''v read the tutorial at GameDev for loading JPEGs to DirectDraw surfaces. I don''t know if any of the JPEG hearder files will work with Dev-C++. Because I can''t offord the Enterprise edition of Visual C++ witch is my dream compiler. What I want to do is make the graphics look good enought with a small amount of color. Then I''ll include them with the resource or maybe another file. I want this program to be realy small and realy fast. I''m trying to make a Sprite struct that will have a RECT for the collisoin detection and another RECT for the frame for the sprite. Then have a few ints for co-ords and stuff like that. I havn''t realy done any game type stuff before. I''v made a billion windows and setup DDraw alot but thats it. I havn''t realy actually used any of it towards any thang. I''m pretty use to setting up a POPUP window and seting up DX(I''m starting to love this API). But I always have problems loading the graphics to the surface ans actualy blitting it to the primary surface or back buffer. The hole role of how thangs are or should go together are starting to get out of hand for me. But the more I do the same thang over and over again(Make a window init DDraw) is starting to drive me nuts. Did any of you guys go through this. It seems to me like most fo you guys on GameDev can say, "Hmmm... I''ll think I''ll make this game today" and be throught it by 2 or 3 hours. Its not this way with me. I have lots of ideas I want to do but I''m having trouble implementing them. I want to make every thang about this game witch is supose to be a Galaxian clone very small and easy. So I can always go back through and use the same engine or make different vesions of the game. I realy need to know how to make a good 2D game engine and how the hole game structure should go for good performance and lots of game play.

Share this post


Link to post
Share on other sites
TGAs are a good choice, they''re very similar to bitmaps and can be run-length encoded to make them small. JPGs aren''t a bad choice for certain things, like textures in 3D games, since the textures are blended anyway so the artifacts aren''t noticeable. In a 2D game, JPGs are probably not the best choice.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
GIFs suck, they are 8-bit only and have a patend on the LWZ compression

just make your own format using ZLIB to compress the bitmap data. There is a tutorial on gamedev that shows how to use the DIB functions to copy the contents of a bitmap file into a DD surface, all you have to do is stick one ZLIB function in there

Share this post


Link to post
Share on other sites
Ok, that helps me a little bit. I also have another question. I''v noticed when I use DDraw I don''t make any delclareations with version numbers bedise them. I do this in my code LPDIRECTDRAW lpdd. But I''v been now starting to notice LPDIRECTDRAW7 thang. So am I loosing functionality by not adding the 7? I thought that the way I was doing it would just make DX genralize on with vesion to use. I don''t clearly understand DX compleetly but I already love it and want to stick with it. Alot of it looks to me pretty simple object/interface->function. Then the rest is just defined to what you want. Seems pretty simple but I''m having more problems getting DX to plot a damn pixel then any thang. I''m reading Windows Game Programming for Dummies and I''m still having a problems with some of it. This is what I wanted to use for my game engine. DDraw for graphics, mmsystem for sounds, and Windows regular WM_KEYDOWN for input. Sence I''m just making a small game this would be good right. I wouldn''t think that a Galaxian clone would need to fully implement DX. One of my biggest problems is getting a picture blitted to the surface like I said before. But I guess I''ll get a hang of it shortly. Like I did with every thang else.

Share this post


Link to post
Share on other sites
When you use, for example, LPDIRECTDRAW7 instead of LPDIRECTDRAW, it gives you access to some advanced features not available on previous versions of DirectDraw. Depending on which features you use, you can get away with using just LPDIRECTDRAW. For example, I use LPDIRECTINPUTDEVICE even though there are LPDIRECTINPUTDEVICE7s that give additional features. I just don''t use those features.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites