#### Archived

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

# 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.

## Recommended Posts

##### Share on other sites
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 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 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:
if(x+32>640)
w = 640 - 635;
else
w = 32;

if(y+32>480)
h = 480 - y;
else
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

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633769
• Total Posts
3013754
×