Sign in to follow this  
BlkDucky

How to deal with resolution?

Recommended Posts

So, I'm working (when I feel like it) on a 2D tile engine... thing. (C++ with SDL, no OpenGL or any of your other fancy... things. ;) ) Anyway. Right now there's no scrolling or anything too amazing, but it's set to a fixed resolution (640x480) and I'm wondering how to deal with larger resolutions? Say I have a 64x64 tile map on a 640x480 screen, and the same map on a 1024x768 resolution screen, the larger screen would see more tiles, which I'd rather avoid as it may give an advantage in certain areas. How do I do this without drawing any more tiles? Or do I just have a fixed resolution because it's "just 2D tiles"?

Share this post


Link to post
Share on other sites
Stretch/scale it ;) If you draw your game view to a different surface and SDL_BlitSurface it to a larger destination rectangle, SDL should stretch it for you.

Share this post


Link to post
Share on other sites
What Valkoran said. You could switch to a second set of tile graphics if the stretched-out lowres graphics look bad.

Another option would be to use a 640x480 region in the centre of the screen, and have the surrounding area black, or, preferably, with a nice and interesting border.

Share this post


Link to post
Share on other sites
Quote:
Original post by Valkoran
Stretch/scale it ;) If you draw your game view to a different surface and SDL_BlitSurface it to a larger destination rectangle, SDL should stretch it for you.
One thing you would need to keep an eye out for is the aspect ratio of the monitor as well or you'll have wider/narrower tiles than you expect.

Share this post


Link to post
Share on other sites
Hm. So you're saying I should make my game have a native resolution at 640x480 or whatever and scale upwards for anything higher? What if it's lower? Can I scale downwards?

Btw: This means I have a SDL_Surface *buffer and draw everything to that, and when I'm done blit the buffer to screen and SDL_Flip(screen), right?

Share this post


Link to post
Share on other sites
You should draw 720 pixels high, and whatever width is appropriate for the aspect ratio (eg 1280 for 16:9, 960 for 4:3). Then you scale up or down to match the player's desired output resolution. This way, widescreens will see slightly more game area, but higher resolutions won't, and everyone gets HD quality.

It's a good balance IMO. If it's a puzzle game or something, where you need exactly x by y tiles, then you'll have to go a different route.

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