[SDL] Questions about SDL 1.3

Mason Wheeler masonwheeler at yahoo.com
Mon Dec 27 13:28:26 PST 2010

I see.  You're working with windows of different resolutions, but you want them 
to all behave as if they were a fixed, predefined resolution and scale 
everything properly to the actual resolution.

That's another problem I had to solve for my game engine, but I haven't 
submitted the patch for it yet.  Basically, I implemented a way to give a 
SDL_Window a "logical resolution" property independent of the physical 
resolution.  This is trivial to implement on the GL renderer (and probably on 
the D3D one as well) by simply setting the viewport to a different size than the 
window's pixel size and letting the GPU handle the conversions.

I'd like to submit the patch, but it contains changes in a lot of the same files 
as my render targets patch, and until that's applied to the source tree it'll be 
really messy to make a patch containing only the "logical size" change set.

From: ebyard <e_byard at yahoo.co.uk>
Subject: Re: [SDL] Questions about SDL 1.3



Wait, what do you mean you can't scale with this? When you draw a rect to the 
renderer, if you make the width and height of srcRect different from the 
dimensions of dstRect, it will scale.  

Maybe I'm not explaining myself very well. You're correct in what you say, but 
my problem is that I draw many individual small rectangles to the renderer, from 
a large texture, for which you have to supply both the source and destination 
rectangles. This is fine if you use one fixed window size.

If not, then you'll need to do a load of math on the destination rectangle to 
get everything scaled correctly - which I haven't figured how to do. Examples 
are very, very welcome.

I'd like to be able to draw a whole new frame on an intermediate texture (of 
size, let's say 1024x768), and then pass that texture to the renderer with NULL 
as the destination rectangle, and so a full screen render on whatever window 
size I'm using.

Make sense?!?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20101227/7d084594/attachment-0008.htm>

More information about the SDL mailing list