• Advertisement

Archived

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

Tile Clipping HELP!

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

How do I clip my tiles while scrolling?? Can someone give me code and explain all the stuff on clipping, I am really confused. here are some specs: tilesize: 40x40 screen res: 800x600 bit mode : 16 bit THX

Share this post


Link to post
Share on other sites
Advertisement
Let there be the light!

Ok,
if you want to have a code sample on VB or VC++ then go to
Planet Source Code
and look after map editors.
Or
I can explain it to you.

Let''s start.

You got map size 800x600, tile height = tile width = 40

So, while you scrolling your map you got TempViewX, TempViewY vars.

So, you say:

For x= int(tempviewx/40) to int(tempviewx/40)+int(800/tile width)
For y=int(tempviewy/40) to int(tempviewy/40)+int(600/tile height)

currentx=x*40-tempviewx
currenty=y*40-tempviewy

backsurface.bltfast currentx,currenty,mytile,mytilerectangle,ddblt_wait or src

next
next

While you scrolling your map, you are increasing or decreasing TempViewX and TempViewY. So, after you changed them you have to redraw visible map, or you can do that ,say, every 1/20 of a second. Right?

Go and have a look at planet-source-code.com
Cyas and good luck!

Share this post


Link to post
Share on other sites
WOW thx! That site is so BIG! Keep the replies coming, more code would be great! Why not use directdraw clippers?

Share this post


Link to post
Share on other sites
You need to use Blt() instead of BltFast when using the ddraw clipper. If you are a speed freak you want to use BltFast instead of blt which is a bit slower that bltfast. BltFast however isnt as comprehensive as blt().

Share this post


Link to post
Share on other sites
BltFast() and Blt() work at the same speed if there''s hardware acceleration.
If there isn''t one, BltFast() is about 10% faster

Share this post


Link to post
Share on other sites

  • Advertisement