[SDL] Key event messages, blits, and dirty rectangles

Neil Bradley nb at synthcom.com
Thu Jul 11 14:08:01 PDT 2002

1) From what I can gather, there are two ways I can check for a specific
key being pressed or released (I need to translate it in to an internal
messaging system based on function assignment to various keys since not
all ports can use SDL):

* By scancode ala key.keysym.scancode, which appears to be platform
specific (I don't know this - I'm just speculating that it is)

* By using key.keysym.sym - the SDL key code for it

I'm assuming that using the latter is the proper way to do it and I should
check it against codes here:


Before I go populating a huge translation table, does this sound right?

2) SDL_BlitSurface() Takes both a source and destination rectangle. This
would allude to the fact that blitting may do a stretch blit - this is a
feature I would like to have. However, if I increase the size of the
destination rectangle, say, to 2X on both axes from the source rectangle,
just the original size gets blitted to the destination. Is a stetch blit
possible at all with SDL?

3) I've noticed that blitting from an 8 bit surface to an 8 bit surface
(offscreen buffer to onscreen buffer) is significantly slower than doing
it via the DirectX route. Is it attempting some sort of palette
translation? If so, how can I shut this off? Both palettes on both
surfaces are surfaces are set identically, so no translation is needed.

4) Is there any way, other than doing my own platform hooks in strategic
places, I can ask SDL what environment it's running under (Windows, Linux,
etc... would be sufficient)? This would be useful in figuring what I'd
have to do to deal with the differences between drive letters (under
Winderz) and explicit paths (everything else).

5) I can't tell from the description or documentation how
SDL_UpdateRect(s) is used. It appears as if this is a method to do dirty
rectangles. If this is the case, I'd like to get more of a description or
perhaps an example of how it actually works to see if I'm doing
unnecessary work. Any ideas on this one?

Thanks again for an excellent library!


Neil Bradley            What are burger lovers saying
Synthcom Systems, Inc.  about the new BK Back Porch Griller?
ICQ #29402898	        "It tastes like it came off the back porch." - Me

More information about the SDL mailing list