🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
help a newbie
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