Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

sprites in c/c++

Ok i just started programming with c/c++ about 3 months ago (mostly c). I am trying to make a DOS game since i dont know near enough to try to make a game for Windows or BeOS. I am just trying to find info on how to go about including sprites into the game source code... any ideas where to look?


Comments

  • : Ok i just started programming with c/c++ about 3 months ago (mostly c). I am trying to make a DOS game since i dont know near enough to try to make a game for Windows or BeOS. I am just trying to find info on how to go about including sprites into the game source code... any ideas where to look?

    :





    Well, though I'm sure I could find plenty of places to look, here (meaning the Programmer's Heaven site) for example, I don't know where they are without searching. (though it wouldn't be a long search).



    However, the general concept(s) are fairly straightforward.



    One approach is not to store the sprite in the source code, but in separate graphics files, this approach only adds a file loader (and handling files right for good latency) to the second approach.



    If you do hardcode the sprites into your program then you've simply skipped the loading it from a file step. There are a couple of ways to represent sprites in memory. The two most straightforward are a bitmap, ie an array of color values, or a RLE coded bitmap, which isn't too much different, just smaller (typically) and faster (typically). There are many other ways you could store it, but I don't see any reason other that to use those, unless you use the next approach.



    The other approach is a compiled bitmap, which basicly means you have a function which draws the bitmap, these have the advantage of allowing you to alter the image in a more programmer-friendly way, and you can omplement certain effects in these a bit simpler. Also, these are likely to be smaller that most bitmaps.


Sign In or Register to comment.