Scrolling a WriteableBitmap

Posted by Skoder on Game Development See other posts from Game Development or by Skoder
Published on 2011-06-26T03:39:40Z Indexed on 2011/06/26 8:30 UTC
Read the original article Hit count: 317

Filed under:
|
|
|
|

I need to simulate my background scrolling but I want to avoid moving my actual image control. Instead, I'd like to use a WriteableBitmap and use a blitting method. What would be the way to simulate an image scrolling upwards? I've tried various things buy I can't seem to get my head around the logic:

 //X pos, Y pos, width, height
 Rect src = new Rect(0, scrollSpeed , 480, height);
 Rect dest = new Rect(0, 700 - scrollSpeed , 480, height);

 //destination rect, source WriteableBitmap, source Rect, blend mode 
 wb.Blit(destRect, wbSource, srcRect, BlendMode.None);
 scrollSpeed += 5;

 if (scrollSpeed > 700) scrollSpeed  = 0;

If height is 10, the image is quite fuzzy and moreso if the height is 1. If the height is a taller, the image is clearer, but it only seems to do a one to one copy. How can I 'scroll' the image so that it looks like it's moving up in a continuous loop? (The height of the screen is 700).

© Game Development or respective owner

Related posts about c#

Related posts about camera