Closed noxer closed 12 years ago
which version of the dcpu studio have you tested your code on?
chessmaster, can you explain how your ring buffer implementation works?
Code has been tested on 0x10co.de, DCPU Studio 20120411, and a couple other misc sites whose names I don't recall.
As for implementation, it is basically a hybrid between the old method of just reading from 0x9000 and the ring buffer. And what it does is read starting at the beginning of the hardware buffer (0x9000) and reads until it finds a null (read: 0) word. The way Notch has the ring buffer currently implemented is that the last key to be pressed fills up the ring buffer until you release the key. At that point the next word gets set to 0. So we just read through the ring buffer up to that point, recording the values along the way until we hit that 0.
so it only captures the last key stroke?
We capture each keystroke that has a corresponding 0 after it. The ring buffer fills with the key code of the key pressed until the key is released or is repeated at which point the DCPU writes a 0 in the next slot in the buffer. This way no matter how long the key is held down (until repeating starts) we only record 1 instance of the key press.
good work chessmaster, after reviewing your code, mine didn't seem to tie into the buffer any good. ah well