Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


displaying tiles

This topic is 6877 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'm working on a tile based graphics engine with direct x. To plot the tiles I created a ddraw surface to place tiles on and then i blt the surface to the back buffer.

Am i using the right method to display the tiles?

Also, I've read that to create smooth scrolling you have to create and extra row and column of tiles, but a ddraw surface in vid memory only allows the surface the size of the primary surface.

Should i create the ddraw surface in system memory to hold the extra row and column of tiles?

Share this post

Link to post
Share on other sites
You only draw an extra row and column. Just clip those to the viewport, no need to make a bigger one.

For instance, in a normal 2d engine with a screen res 640x480 and tiles 32x32 you would have to have 20 columns and 15 rows.

for(row=0;row<15;row++) {

But, when the tiles scroll left and up a couple of pixels, you'll see that many pixels of empty space to the right and bottom of the screen. Simply increase the number of rows to 16 and columns to 21, then draw as normal:

for(row=0;row<16;row++) {

Jim Adams

Share this post

Link to post
Share on other sites

  • 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!