How to deal with resolution?
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"?
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.
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.
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.
Quote:Original post by ValkoranOne 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.
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.
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?
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?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement