Sign in to follow this  

Direct X 10 2D tilebased scrolling

Recommended Posts

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.

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this