sprites in c/c++ - Programmers Heaven

Howdy, Stranger!

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

Categories

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.