Re: need delay while key not pressed

Jonathan Dearborn <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <CA+DSiHZ_PJ0yTQ2tKbF4f0E9_cuUVxVt3P5n9HEMoWWDqkxZLA@mail.gmail.com>
Your code enters a hard loop where it delays forever.  Nothing changes any
variable that would help the loop to end, so your OS is helpfully telling
you there's a problem.

SDL can only change the 'event' variable if you give it control, say, in a
function like SDL_PollEvent().  `event.key.keysym.scancode` will not
magically change on its own.  Use SDL_PollEvent() in your delay loop and
then you'll be getting somewhere.

Jonny D


On Sat, Jul 9, 2016 at 7:38 PM, bilsch01 <[email protected]> wrote:

> Thanks. That is the solution. But now I have another problem: When the
> program is in the delay loop it doesn't exit when 'L' is pressed. Then
> after about 4 seconds the screen dims down. I want the frozen display to
> stay to stay on the screen until the 'L' key is pressed, then continue
> execution.
>
> Bill S.
>
> _______________________________________________
> SDL mailing list
> [email protected]
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.