Sign in to follow this  

Fullscreen with scroll

This topic is 3813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i've created a surface, then i've loaded a Bitmap with D3DXLoadSurfaceFromFile actually a map from europe(1600x1700) everything works fine, the program compile and show me the portion of the map that i can actually see because the screen is in 1024x768 but now i want see the rest of the map moving when the mouse reach the borders of the screen, i've looked how to do that but i can't find nothing. I hope you could help me. Sorry my poor english.

Share this post


Link to post
Share on other sites
Draw as pair of quads, calculate UV coordinates and blit on screen (example: 0,0800,600). Changing UV coordinates of quad you will scroll your bitmap.
Actually it is bad idea to load such a big textures. Not every graphic card can support such a textures sizes.
Instead of that split your texture in smaller pieces and draw them on appropriate position.But that will again change your rendering and scrolling method.

Share this post


Link to post
Share on other sites
As streamer alluded to, the general solution here is to use texture coordinates to scroll as needed. If I were doing this I would try to find a source image that is larger than 2048x2048 (which is probably what your texture is in memory) and resize to that (or 1024x1024).

Just note that you don't need to (and usually don't) have a direct pixel to texel mapping in Direct3D. Instead of scrolling, is it an option to just draw a fullscreen quad and let D3D resample it as necessary?

If you do need to scroll, I would keep track of whether the mouse is in the 'border region' (say last 5 or 10 pixels to the edges) and if so would set some sort of 'currentlyScrolling' variable to true. Then I would increment a floating point scroll counter (you'll need one for x and y) by a constant velocity whenever this variable is true, taking into account the frame time to determine the actual increment. Finally, use your scrollX and scrollY variables to determine the starting and ending texture coordinates (TU, TV pairs) for your map quad using basic math.

Share this post


Link to post
Share on other sites

This topic is 3813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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