Sprite function in DJGPP C++!!!
Hi, I´m Corrosive, and I need help to make a function to read sprites in C++ using DJGPP!!!
Please, if you folks can, send-me a tutorial on how to make the damn function!!! Thank´s a lot!!!
To code is to make things come to life ;)
March 08, 2000 01:09 AM
A sprite is only a graphic, so what format? PCX, Targa, Bitmap, JPEG, etc? Are you planning on doing animation? What color format do you want to support, 16/15 bit 24bit, 32bit, 8bit? You may want to consider using the Allegro graphics library to get things going faster for you, it''s an api for doing exactly what you want. Later!
Thank´s, but this is not the problem... I have been misunderstanded!!! What i really want to know is how i make the function to move myself into a matrix of arrays in a bitmap or pcx picture with all the sprites i want and then, how i read exactly the portion of the file i want?!?!?
Thank´s....
Thank´s....
To code is to make things come to life ;)
I''ve written just the kind of thing you''re asking for, but I''m in the middle of converting it from DJGPP to DirectDraw. What I used was one file per animation, and since I used 16 bit colour (and 16 bit bitmaps don''t exist), I took a bunch of 24 bit bitmaps and saved the animation in my own 16 bit file type. You could write a similar program to do this yourself.
Once you have your animations in their own files, you can load them into memory easily with DJGPP, and display them quite easily as well. The only problem is management of that memory - I used a structure of image pointers, that holds the offset of the image data, as well as details about the animation (width, height, frames etc). You can then display different sections of your image data to animate objects in your program.
I think what you''re asking is "how do you load a small square out of a bitmap into memory?". And the answer is: You don''t. It CAN be done, but it is considerably more complicated than writing your code the way I suggested. (There may be a better way... anyone?) Bitmaps are stored in rows of pixels, which means that if you want a small square of data, you have to assemble it from many rows, and consequently, many places in the file.
-----------
C++ is the language of the not-so-ancients.
Learn to speak it well.
BeamMeUp
Once you have your animations in their own files, you can load them into memory easily with DJGPP, and display them quite easily as well. The only problem is management of that memory - I used a structure of image pointers, that holds the offset of the image data, as well as details about the animation (width, height, frames etc). You can then display different sections of your image data to animate objects in your program.
I think what you''re asking is "how do you load a small square out of a bitmap into memory?". And the answer is: You don''t. It CAN be done, but it is considerably more complicated than writing your code the way I suggested. (There may be a better way... anyone?) Bitmaps are stored in rows of pixels, which means that if you want a small square of data, you have to assemble it from many rows, and consequently, many places in the file.
-----------
C++ is the language of the not-so-ancients.
Learn to speak it well.
BeamMeUp
-----------C++ is the language of the not-so-ancients.Learn to speak it well.BeamMeUp
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement