Pre-Sprite Scaling

Started by
2 comments, last by LordShade 16 years, 1 month ago
I am making a game that the playfield is just on a single screen. No matter what the resolution the playfield should use up the screen space. Now I know how to do this but how can I do this efficiently? Basically scaling my sprites on every screen resolution change and saving them to use later. Thoughts? Next question is would it be worth it? All my sprite size and blt'ing code would also have to adjust. C#/XNA
Advertisement
There's no need to scale your sprites. You can simply render all of your sprites to an off-screen render target, with that set to a resolution of your choice. Then, you can scale that render target to the target resolution of the screen or window. This will should allow you to handle arbitrary resolutions without adjusting any of your game logic and with minimal changes to your render path.

As for the syntax for doing this...you'll have to ask someone else as I'm not familiar with XNA.
I know in OpenGL it was easy enough to specify the same orthographic dimensions for the viewport regardless of resolution, that way everything got scaled without an extra RTT and copy step.
What I'm trying to do is to not have DirectX/XNA scale every frame. This would allow me to drop the hardware requirements significantly.

I haven't looked at the sprite stuff yet but scaling is something that's been bubbling in the back of my mind because I'm getting close. Initially I will just do ortho projection to 'get it working.'

Was just wondering if anyone else has done this and if there are any benefits.

This topic is closed to new replies.

Advertisement