From: Sander Land Date: 2006-08-01T04:43:44+09:00 Subject: Re: [QUIZ] Chip-8 (#88) On 7/31/06, James Edward Gray II wrote: > On Jul 30, 2006, at 1:55 PM, Sander Land wrote: > > > I used one Win32 function (GetKeyState) as I didn't know a compatible > > way to check if a key is pressed. > I discuss this a little at the end of this summary: > http://www.rubyquiz.com/quiz5.html > You can also use HighLine for this. I installed highline and checked the docs as well as the source and couldn't find anything. GetKeyState checks if a key is currently held down and not if it was pressed, so get_character does not do what i want. An earlier implementation used kbhit/getch, but that didn't work at all because games like breakout check key input like: V0 = 4 skip unless key V0 pressed V0 = 6 skip unless key V0 pressed And the repeat rate of keys seems to be too slow for the "6" to trigger even if you hold the key down. One other thing I tried is saving a key as held down for 0.25s if it was pressed, but that was far too unreliable. The two "@key_timer" lines of my code are a leftover from this which I forgot to remove.