Jump to content
  • Advertisement
Sign in to follow this  
Yenn

Keeping track of graphics

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

Hey. I've got a few questions about keeping track of and dealing with graphics. I'm making a small isometric strategy game in C++ (using the SDL). I've looked through a lot of different resources and articles, but I can't seem to find anything dealing with the best way to keep track of which graphics are loaded/keeping references to them. I'm hoping this question fits here, because it is general graphic programming, though I'm using a few C++-specific things. How should I deal with tiles? The best thing I can think of is to have a LoadTile(id) function which is called whenever I try to draw a tile. The function checks a map (loadedTiles[id]) and if it returns a null pointer, it will load the tile image, add a reference to it to a deque, and then add the tile's position in the deque to the loadedTiles[id] map. If the LoadTile(id) function finds that loadedTiles[id] isn't a null pointer, it will just use the image that the map is pointing to. Are there any better ways to handle this? My idea for the GUI is basically the same. All the GUI pieces are loaded into a deque, then accessed by functions that put the GUI together. However, I'm a bit lost when it comes to object sprites. (i.e. characters) How do I keep track of their animation sets? I was thinking of doing something like creating an animation struct and having it store pointers to all the animations of that character. i.e. character1.walk would point to an array of character1's walk sprites. Can anyone give me suggestions on the best ways to deal with these things?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!