Jump to content
  • Advertisement
Sign in to follow this  
Side Winder

(C++) Using Layers (likely with Win32)

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

I've been told that using layers in a game would smooth movement. Currently what I'm doing is: Drawing Waiting Erasing Re-drawing (1 pixel ahead or whatever) I've been told this is inefficient and that I should use layers.. Is there anywhere I can learn about layers? I know the (very) basics from using Photoshop but I don't know how I could use layers to smooth the game out?

Share this post


Link to post
Share on other sites
Advertisement
You'll have to be more specific. Are you talking about layers for a 2d tile-based game? As in, render the background, render the foreground, then render objects?

It almost sounds as if you mean flipping a backbuffer when you talk about "smoothing movement".

Share this post


Link to post
Share on other sites
Yeh, it's a 2D asteroids game. I'm drawing the ship as a hollow ship with 3 lines (basically a triangle). So currently I'm drawing the ship, then erasing it, then re-drawing it in a different location.

Share this post


Link to post
Share on other sites
When I made a 2D RPG, I did everything with 32*32px tiles. My characters were 1 tile wide and 2 tiles tall. I would first blt the background, if applicable, like distant mountains or a horizon on the ocean. Then, I would reference the tilemap for an index, and blt the tile at the index in the tilset for that map. Then, I would blt each character / object on top of the tiled map.

I never bothered erasing anything, since the whole thing got repainted every frame. You could just mark certain regions as "dirty" whenever its contents change, and repaint just that region, but my way is much easier to code.

I'm still not sure what you mean by "layers". Are you talking about the approach I described?

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!