Jump to content
  • Advertisement


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

Chris F

help a newbie

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

ok, ive worked out how to blt all the tiles, and scroll the map the only problem is if a tiles position overlaps the edge of the screen, the tile wont show up on the screen, i really dont know why this is and i cant seem to find a solution, please help me, im using directx and c++, thanks in advance for any help.

Share this post

Link to post
Share on other sites
Hi, im making an isometric game and im not sure what the best blitting algorithm is for displaying all the tiles, any help would be much appreciated.

Share this post

Link to post
Share on other sites
Hellou. when you blit a surface to another, the destination rect (I'm assuming you're using blt, not bltfast, thou the idea is simmilar), as I was saying, the destination rect can't have any area outside of the destination image, or in your case, you have to reduce it to fit inside the screen. The problem is, you have to do the same transformation you did to the dest rect to make it fit into the screen to the origin rect (for instance, if you had to cut the last five pixels of the dest rect, you'll have to cut the last five pixels of the origin rect) otherwise you'll scale the tile.
I think that bltfast is pretty much the same thing, only you just have to worry with the origin rect.

example; say you have a 640X480 screen, and a 32X32 tile you wanted to draw at (x=635,y=10)

consider w,h:
w = 640 - 635;
w = 32;

h = 480 - y;
h = 32;

your dest rect would be (left, top,right,bottom): (x,y,x + w, y + h),
and your origin rect would then be: (0,0,w,h)

NOTE(S) The above code isn't supposed to be optimized in any way, was just coded from head to give you an idea about the process
Secondly, and most important, I'm not sure if the rect order is the one above, so be carefull if you use any of this in your program. Now if I were an attorney, I'd be saying the code is supplied on an "as is" basis; and the buttler did it! hitch again!
3rd, it may happen that some of the dimensions above exceed by one pixel the surfaces. if you keep on getting nothing, try subtracting one from w and h.
4th, you should use predefined variables or consts to define the width and height of the scren and tile.
5th don't forget to put comments on your code, just like i didn't do above,
6th, if you're still reading this, you have a lot of patience.
Merry christmas

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!