Sdlk_lalt

I need to know when Left ALT is pressed, and when it’s released. After ALT I am
pressing another key, then releasing it.
When I use kbhits=SDL_GetKeyState(NULL) it happen that ALT is pressed and
kbhits[SDLK_LALT]==0.
When I use SDL_KEYDOWN/KEYUP events it happen that ALT is released and I
don’t catch KEYUP event.
Is it bug in my program or it works that way?–
In the land of no tomorrow
Where you pray just to end each day
And your life just slowly melts away “Egypt (The Chains Are On)”
- Ronnie James Dio

I’m not sure about the lost KEYUP thing… Keyboard ghosting phenomena?
(If you press the “wrong” combination of keys at the same time, the
keyboard CPU won’t be able to tell exactly which keys are held down. Good
keyboards will handle this without stray make or break codes, but not all
keyboards are that carefully designed.)

Anyway, note that SDLK_LALT != SDLK_RALT. Also, don’t confuse them with
the KMOD_* symbols - those are not indices in the keystate array.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Tuesday 20 November 2001 03:30, Jacek Pop?awski wrote:

I need to know when Left ALT is pressed, and when it’s released. After
ALT I am pressing another key, then releasing it.
When I use kbhits=SDL_GetKeyState(NULL) it happen that ALT is pressed
and kbhits[SDLK_LALT]==0.
When I use SDL_KEYDOWN/KEYUP events it happen that ALT is released and
I don’t catch KEYUP event.
Is it bug in my program or it works that way?

Jacek Poplawski wrote:

I need to know when Left ALT is pressed, and when it’s released. After ALT I am
pressing another key, then releasing it.
When I use kbhits=SDL_GetKeyState(NULL) it happen that ALT is pressed and
kbhits[SDLK_LALT]==0.
When I use SDL_KEYDOWN/KEYUP events it happen that ALT is released and I
don’t catch KEYUP event.

try the checkkeys program in the test directory. If that works, it’s a bug
in your program. Otherwise, it’s a a platform-specific problem — post
an example program (less than 20 lines) that exhibits the bug

Hi there;

I’m in the finishing stage of an SDL-based project that “doesn’t look
pretty enough”, mainly because the game screens fail to match the desired
Photoshop mock-ups. And this is largely due to the fact that the mock-ups
are composed of many layers, alpha-blended together and with the rough
edges anti-aliased away. Is there a cheap way, or a readily available
routine, which will work with SDL to blit a surface into its immediate
background? Or do I have to write one myself?

cheers,–
Matthew > http://www.soup-kitchen.net/
> ICQ 19482073

I’m not sure if I misunderstod your problem, or that I have a good
solution ;). But I use SDL_Image and .tif images with alpha channel
to blit stuff so that it looks “photoshopish”.

/Johan

If you are refering to a method of blitting an image onto a surface with
alpha blending or something similar, no. SDL only provides methods for
"regular" blitting. You will have to write such a function yourself.

I’ve written such functions myself using MMX. Email me at arpen at home.se if
you want to have a look at them.

/Rickard

No. You can see a screenshot here:

http://www.obilot.de/screenshot2.jpg

You can clearly see how the mouse pointer is alpha blended(sp?) onto the
screen by SDL. RTFM.

-JakobOn Tue, Nov 20, 2001 at 04:44:43PM +0100, Rickard Andersson wrote:

If you are refering to a method of blitting an image onto a surface with
alpha blending or something similar, no. SDL only provides methods for
“regular” blitting. You will have to write such a function yourself.

Well, excuse me then! I didn’t know that this was supported. I only thought
you could set the alpha value for the “whole” surface and then blit that
surface onto another surface. This probably works fine, but I have no use
for it as I need different alpha-values on different parts of the screen.

From what I understand the only way to do alpha blending with native SDL is
to eigher just set the alpha value for the “whole” surface with SDL_SetAlpha
or to use the SDL_Image library and use a format such as tif with alpha
channels.

/Rickard> ----- Original Message -----

From: jakob@obilot.de (Jakob Kosowski)
To:
Sent: Tuesday, November 20, 2001 5:01 PM
Subject: Re: [SDL] Tips for smooth blitting?

On Tue, Nov 20, 2001 at 04:44:43PM +0100, Rickard Andersson wrote:

If you are refering to a method of blitting an image onto a surface with
alpha blending or something similar, no. SDL only provides methods for
“regular” blitting. You will have to write such a function yourself.

No. You can see a screenshot here:

http://www.obilot.de/screenshot2.jpg

You can clearly see how the mouse pointer is alpha blended(sp?) onto the
screen by SDL. RTFM.

-Jakob


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

After detecting “LALT+f” I call SDL_SetVideoMode, becouse I must turn
"fullscreen" on/off. When I commented my SetVideoMode function - everything is
right. Is it possible that calling SDL_SetVideoMode is problem here?On Tue, Nov 20, 2001 at 05:38:58AM +0100, David Olofson wrote:

I’m not sure about the lost KEYUP thing… Keyboard ghosting phenomena?


Oh I see his face! Where is your star?
Is it far, is it far, is it far?
When do we leave?
I believe, yes, I believe “Stargazer” - Ronnie James Dio

“Jacek Pop?awski” wrote in message
news:mailman.1006286527.28485.sdl at libsdl.org

I’m not sure about the lost KEYUP thing… Keyboard ghosting phenomena?

After detecting “LALT+f” I call SDL_SetVideoMode, becouse I must turn
"fullscreen" on/off. When I commented my SetVideoMode function -
everything is
right. Is it possible that calling SDL_SetVideoMode is problem here?

Yes. I observed the same problem sometime last year. Appearently it still
hasn’t been fixed.> On Tue, Nov 20, 2001 at 05:38:58AM +0100, David Olofson wrote:


Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

When you set the video mode, it resets the state of the keyboard, but
doesn’t send any events (to avoid confusing legacy code). Whenever
you set the video mode, just reset your internal key state, or better,
use the SDL_GetKeyState(), which should have the correct key state.

If SDL_GetKeyState() doesn’t report the correct key state, please report
it as a bug and mention which platform and video driver you’re using.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment> On Tue, Nov 20, 2001 at 05:38:58AM +0100, David Olofson wrote:

I’m not sure about the lost KEYUP thing… Keyboard ghosting phenomena?

After detecting “LALT+f” I call SDL_SetVideoMode, becouse I must turn
"fullscreen" on/off. When I commented my SetVideoMode function - everything is
right. Is it possible that calling SDL_SetVideoMode is problem here?

I’m not entirely sure what you mean… Isn’t RLE accelerated alpha
blending sufficient?

Look at Kobo Deluxe; the game window has an alpha blended border that’s
responsible for the rounded corners, the fade-out around the edges and
the glass highligts in the top-left and bottom-right corners. It’s all
done by blitting a single RLE encoded RGBA surface over the game window,
after rendering each frame.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Tuesday 20 November 2001 16:21, Matthew Bloch wrote:

Hi there;

I’m in the finishing stage of an SDL-based project that “doesn’t look
pretty enough”, mainly because the game screens fail to match the
desired Photoshop mock-ups. And this is largely due to the fact that
the mock-ups are composed of many layers, alpha-blended together and
with the rough edges anti-aliased away. Is there a cheap way, or a
readily available routine, which will work with SDL to blit a surface
into its immediate background? Or do I have to write one myself?

Well, excuse me then! I didn’t know that this was supported. I only thought
you could set the alpha value for the “whole” surface and then blit that
surface onto another surface. This probably works fine, but I have no use
for it as I need different alpha-values on different parts of the screen.

From what I understand the only way to do alpha blending with native SDL is
to eigher just set the alpha value for the “whole” surface with SDL_SetAlpha
or to use the SDL_Image library and use a format such as tif with alpha
channels.

Okay, so loading TIFF images with per-pixel alpha data SDL_image will
allow for blending images into their backgrounds? Didn’t know that was
do-able, was under the same impression you were, that you could only set
the alpha value for the whole surface and ‘fade’ it in and out.

cheers everyone,On Tue, 20 Nov 2001, Rickard Andersson wrote:


Matthew > http://www.soup-kitchen.net/
> ICQ 19482073

Okay, so loading TIFF images with per-pixel alpha data SDL_image will
allow for blending images into their backgrounds? Didn’t know that was
do-able, was under the same impression you were, that you could only set
the alpha value for the whole surface and ‘fade’ it in and out.

Actually I haven’t tried it, but Johan Andrin said (a few posts down):

“…I use SDL_Image and .tif images with alpha channel
to blit stuff so that it looks “photoshopish”.”

I just assumed he wasn’t bullshiting :slight_smile:

/RickardFrom: mattbee-sdl@soup-kitchen.net (Matthew Bloch)
Sent: Tuesday, November 20, 2001 11:11 PM
Subject: Re: [SDL] Tips for smooth blitting?

I need to know when Left ALT is pressed, and when it’s released. After ALT I am
pressing another key, then releasing it.
When I use kbhits=SDL_GetKeyState(NULL) it happen that ALT is pressed and
kbhits[SDLK_LALT]==0.
When I use SDL_KEYDOWN/KEYUP events it happen that ALT is released and I
don’t catch KEYUP event.
Is it bug in my program or it works that way?–
In the land of no tomorrow
Where you pray just to end each day
And your life just slowly melts away “Egypt (The Chains Are On)”
- Ronnie James Dio