SDL_ResetKeyboard() in SDL_SetVideoMode()

Hello,

I am using SDL 1.2 with OpenGL in a cross-platform game: bitfighter
(bitfighter.org). One thing we have is three video modes:

  1. Windowed
  2. Fullscreen scaled
  3. Fullscreen stretched

We use ALT + ENTER to switch modes.

One thing we’d like to do is quickly switch modes by holding down ALT
and tapping ENTER twice. However, SDL_ResetKeyboard() is being called
every time SDL_SetVideoMode() is called and is preventing the ALT from
being detected on the second tap of ENTER.

Is there a reason for SDL_ResetKeyboard() being called here that I’m not seeing?

Is there a possible workaround for this in the standard SDL 1.2 API?
I can easily comment out the offending line in SDL_video.c and
recompile for our windows and mac platforms since we distribute the
SDL library with the game; however, linux is a different story…

Thanks for any help!
D

Well, IF i decided to recompile libSDL with the removal of
SDL_ResetKeyboard() from SDL_SetVideoMode() for our two most prominent
platforms (windows, mac) would there be any other side-effects other
than the behavior I want?

Thanks!
DOn Sat, Dec 3, 2011 at 5:56 PM, D B <@D_B> wrote:

Hello,

I am using SDL 1.2 with OpenGL in a cross-platform game: ?bitfighter
(bitfighter.org). ?One thing we have is three video modes:

  1. ?Windowed
  2. ?Fullscreen scaled
  3. ?Fullscreen stretched

We use ALT + ENTER to switch modes.

One thing we’d like to do is quickly switch modes by holding down ALT
and tapping ENTER twice. ?However, SDL_ResetKeyboard() is being called
every time SDL_SetVideoMode() is called and is preventing the ALT from
being detected on the second tap of ENTER.

Is there a reason for SDL_ResetKeyboard() being called here that I’m not seeing?

Is there a possible workaround for this in the standard SDL 1.2 API?
I can easily comment out the offending line in SDL_video.c and
recompile for our windows and mac platforms since we distribute the
SDL library with the game; however, linux is a different story…

Thanks for any help!
D

Another option is to use another key binding, or just use Alt+Enter and
have some sort of state variable to tell the window what sort of display
you’re going to use.
Just my thoughts, though.
As far as what would happen with removing that line in the code, I’m not
sure if there would be any ill side effects, but I’d make sure you call the
reset keyboard function at the beginning of your program to make sure you
have a clean buffer

Take care,
-AlexOn Mon, Dec 12, 2011 at 2:55 PM, D B wrote:

Well, IF i decided to recompile libSDL with the removal of
SDL_ResetKeyboard() from SDL_SetVideoMode() for our two most prominent
platforms (windows, mac) would there be any other side-effects other
than the behavior I want?

Thanks!
D

On Sat, Dec 3, 2011 at 5:56 PM, D B wrote:

Hello,

I am using SDL 1.2 with OpenGL in a cross-platform game: bitfighter
(bitfighter.org). One thing we have is three video modes:

  1. Windowed
  2. Fullscreen scaled
  3. Fullscreen stretched

We use ALT + ENTER to switch modes.

One thing we’d like to do is quickly switch modes by holding down ALT
and tapping ENTER twice. However, SDL_ResetKeyboard() is being called
every time SDL_SetVideoMode() is called and is preventing the ALT from
being detected on the second tap of ENTER.

Is there a reason for SDL_ResetKeyboard() being called here that I’m not
seeing?

Is there a possible workaround for this in the standard SDL 1.2 API?
I can easily comment out the offending line in SDL_video.c and
recompile for our windows and mac platforms since we distribute the
SDL library with the game; however, linux is a different story…

Thanks for any help!
D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org