Direct X 10 2D tilebased scrolling

Started by
0 comments, last by brekehan 14 years, 10 months ago
Hey everybody I have been studying direct x 10 now for about a month or 2 and I'm trying to figure out how to do tilebased scrolling in dx 10. I know when I was working in dx 9 that if I wanted to do something like this I would create an off screen surface to hold my tiles, and an off screen surface to build the map and then once the map was build I would just use StretchRect to pull a portion of the offscreen map to the screen. But I cant find any info about off screen surfaces in dx 10. I've been reading about how you can create textures and load stuff into there and I've read some people say that you should create quads and then render the map to that but I guess I dont know where to begin when it comes to this part. I know how to setup the camera, and stuff to display it but I dont know how to build the map and then display only a portion of it to the screen. Any help would be greatly appreciated.

Darcmagik

Of all the things I've lost I miss my mind the most.

Advertisement
One suggestion:

Make a quad the size of the screen.
Give the quad texture coordinates less than the size of the entire texture.
In your shader add an offset to the texture coordinates.
In your app update the offset every frame.
Essentially, scroll the texture across your quad.

For example, you could split a texture into 8 screens.
When you come to the end, switch textures.



This topic is closed to new replies.

Advertisement