[SDL] New Libtool Scripts

Torsten Giebl wizard at synolution.com
Fri Nov 21 00:49:01 PST 2003


On Thu, 2003-11-06 at 12:51, barrett at 9hells.org wrote:
> Hello David, and all others, I'm new to this list.
> I subscribed because I'm having a problem with missing keys, and I expect 
> to have some help here for more experienced SDL developers.
> 
> I work for a company that makes mp3 jukeboxes, mounted on arcade-like
> machines. We also make a MAME-based arcade. As a hobby, I also develop
> a SDL-based RTS game: http://palito.9hells.org/
> 
> In a new version of our jukebox, we use a barcode reader, that connects
> to the keyboard input, and sends a sequence of digits, just like
> regular keystrokes, when it reads a barcode card.
> 
> In my main loop, I do SDL_PollEvent(), and in case there's no event,
> I do a SDL_Delay(1), just to prevent unecessary 100% CPU usage.
> To my surprise, SDL is missing some keys! That shouldn't happen,
> event if my event loop is not well designed, and is lagging to
> catch the events, because (I think) there is an event queue (buffer),
> right?  If I remove the SDL_Delay(), this doesn't happen.

You need to let us know which OS you are running on so we can properly
answer the question. Some points to consider.

o There is an event queue. If it fills up SDL quietly drops the events.

o On most OSes a SDL_Delay(1) will wait for an average of 5
milliseconds. That happens because the clock ticks every 10
milliseconds. In a tight loop such as the one you describe the delay
will tend to synch up with the clock and you will usually delay slightly
less than 10 milliseconds.

o Event handling is OS specific so, to really understand what is going
on you have to look at the code for the OS you are using.

My *guess* is that the bar code scanner is send keys very quickly and
some of them are getting dropped by the OS. How many characters are
being sent? Is the OS buffering them too? If so, how big is its buffer?
Is it big enough to hold all the data the card reader is sending? If
not, the characters are mostly like being dropped by the OS during the
long wait for SDL_Delay(1) to return.

			Bob Pendleton


> 
> 
> Regards,
> barrett
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
-- 
+---------------------------------------+
+ Bob Pendleton: writer and programmer. +
+ email: Bob at Pendleton.com              +
+ web:   www.GameProgrammer.com         +
+---------------------------------------+





More information about the SDL mailing list