Scrolling Screen relative to player position

Feb 18, 2014 at 7:07 PM
Hi there, I just wondered if anyone here knows how to do some kind of screen scrolling relative to the players position.

For example, when the player moves towards the top of the screen the "world" moves with them allowing them to see additional objects etc that they couldn't see due to them being too far away from them.

Thanks
Coordinator
Feb 18, 2014 at 7:08 PM
This is something you handle through camera view coordinates depending on your world coordinates, and is not specific to DirectXTK. You should use your favorite search engine to find various resources on how to implement this.
Feb 18, 2014 at 7:11 PM
walbourn wrote:
This is something you handle through camera view coordinates depending on your world coordinates, and is not specific to DirectXTK. You should use your favorite search engine to find various resources on how to implement this.
So would this be done through something such as a CD3D11_VIEWPORT?
Coordinator
Feb 18, 2014 at 8:35 PM
Edited Feb 18, 2014 at 8:37 PM
Transformations are handled by vertex shaders typically. If you are using SpriteBatch, you'd use the custom transformation matrix parameter on SpriteBatch::Begin. See the wiki docs.

Note that this XNA Game Studio tutorial is applicable (although the details are of course different for C++ code using DirectXTK). Platformer: Adding a Scrolling Level
Marked as answer by walbourn on 2/18/2014 at 12:37 PM