Key event messages, blits, and dirty rectangles

  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:

http://sdldoc.csn.ul.ie/sdlkey.php

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

  1. 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?

  2. 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.

  3. 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).

  4. 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-------------------------------------------------------------------------------
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

  1. 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?

As far as I know, there is no such thing in SDL.
All the rectangles do is specifying which part of the surface gets
blitted.
SDL is the Simpel DirectMedia Layer. If you want strech blit you’ll have
to write it yourself. There aren’t even any graphics primitives in
standard SDL.

  1. 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.

Use SDL_DisplayFormat() on your surface first.
Otherwise it gets converted on-the-fly every time you blit it.

  1. 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).

You could use macros and #ifdefs.
Call your compiler like this in your Windows makefile:
gcc -DWIN32 foo.c -o foo.o
and like this in Linux:
gcc foo.c -o foo.o

And in your code:
#ifdef WIN32
open (“C:\foo”)
#else
open ("/foo");
#endifOn Thu, 2002-07-11 at 23:17, Neil Bradley wrote:

Hello.

  1. 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?

As far as I know, there is no such thing in SDL.
All the rectangles do is specifying which part of the surface gets
blitted.
SDL is the Simpel DirectMedia Layer. If you want strech blit you’ll have
to write it yourself. There aren’t even any graphics primitives in
standard SDL.

SDL_Rotozoom may help. Look it up on the libraries page at libsdl.org.

./lxnt

SDL is the Simpel DirectMedia Layer. If you want strech blit you’ll have
to write it yourself. There aren’t even any graphics primitives in
standard SDL.

There isn’t a stretch blit in the public API, but you can have a look at
SDL12/src/video/SDL_stretch.c …

  1. 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).

http://icculus.org/physfs/

:slight_smile:

–ryan.

SDL_Rotzoom is obsolete. You should try SDL_gfx instead.On Fri, 2002-07-12 at 08:51, Alexander Sabourenkov wrote:

Hello.

As far as I know, there is no such thing in SDL.
All the rectangles do is specifying which part of the surface gets
blitted.
SDL is the Simpel DirectMedia Layer. If you want strech blit you’ll have
to write it yourself. There aren’t even any graphics primitives in
standard SDL.

SDL_Rotozoom may help. Look it up on the libraries page at libsdl.org.

I’m curious. Any chance we can somehow denote the "obsolete"
libraries on the SDL page?

It’s also be super-keen if they could be categorized, somehow…
(e.g., “C++ wrappers”, “Font libraries,” “Sprite Libraries,”
“Sound libraries,” and so forth…)

-bill!On Fri, Jul 12, 2002 at 10:12:18AM +0200, Hongli Lai wrote:

SDL_Rotzoom is obsolete. You should try SDL_gfx instead.

http://www.libsdl.org/libraries.php?action=listcategoriesOn Friday 12 July 2002 10:32, nbs wrote:

It’s also be super-keen if they could be categorized, somehow…
(e.g., “C++ wrappers”, “Font libraries,” “Sprite Libraries,”
“Sound libraries,” and so forth…)


Johannes Schmidt

< http://libufo.sourceforge.net > Your widget set for OpenGL