When I started out making games, I used SDL exclusively. All the games
I made were 2D, and this was a great solution in general. My only big
complaint about SDL was that changing screen sizes and resolutions
wasn’t the easiest thing in terms of making things look right. For
example, lets say I created a screen @ 640x480, and setup some menus
so that the text was a certain size and position and looked good. Then
later I decide that the user should be able to switch resolutions. But
when the mode switches to 1024x768 or larger, that same text looks
teeny, and isn’t layed out so efficiently now.
SDL is a great solution “in general.” I sincerely hope you understand
you “only big complaint about SDL” has nothing to do with SDL. This has
to do with modern video game design.
When I started to program in OpenGL (in ortho mode, for example), I
noticed an amazing thing - OGL is really good at switching resolutions
and keeping everything in perspective. The same menus that looked
great in 640x480 still look great and proportionate in higher
resolutions. And no real extra work was needed on my part. So OpenGL
makes as great a 2D engine as it does a 3D engine.
This is the nature of scalable vector graphics. It is one of the
solutions that had come to mind when I read your first paragraph.
Either that, or you’re texturing everything, and OpenGL is performing
very eye pleasing filtered resizes on all of the imagery in your game’s
UI. You could do this in SDL too without using OpenGL. If this is the
ONLY REASON you’re using OpenGL, I recommend doing the filtering
yourself whenever you load the imagery from the disk.
Now yes, I know you can kind of mix SDL and OGL. But here is my
question - using SDL only (no OGL) is there a good way to maintain the
aspect ratio of graphics and text to screen size? Was there something
I was missing? Or is it totally dependent on the programmer to account
for the sceen resolution and adjust the graphics accordingly?
I guess I got a little ahead of myself (or yourself) in my last
paragraph. The best compromise of a great looking hand-crafted artistic
looking game UI (think the Starcraft interface) and practical creation
time for an amateur developer is to do this:
Have the person responsible for creating the UI art create it at a very
high resolution (an art student would do this naturally, having already
learned why.) Then you have two options: either scale down the images
to preset resolutions and ship them with your game. Or ship the large
versions with your game, and have your game resize them each time the
game loads, and when the display is resized. (A little optimization
there might be to cache the resized imagery on the hard disk so that
the images don’t need to be resized and filtered every time the game
starts up.)
The other option is to use some sort of scalable vector graphics. As I
understand it there is a standard SVG format using XML, but you don’t
necessarily need to know that. I am not very knowledgeable about what
technology has already been to the end of an SVG library, but you’re
free to research that yourself or wait for someone to post it in this
thread in response to me talking about it. Using SVG, your game would
probably load the vector graphics at the beginning of the game, and
rasterize them before using them. Again, you could optimize game load
time by caching the rasterized versions on the hard disk.
Rasterization is (at least) taking a vector graphic like W3C’s SVG
format, or Apple’s ICNS format, or TTF true type fonts, and rendering
them as a flat image. You do this whenever you want to use some vector
graphics at a single scale for a while (like, until the player alters
his game resolution.) This way you don’t need to keep rerendering the
actual vector graphics themselves, but rather just blit their
prerendered rasterization.On Sep 23, 2004, at 12:27 PM, Todd Davis wrote: