Open Mutaru16bit opened 4 years ago
I would assume, that that behavior is intentional. Imagine a text-input. Here you would want to receive all missed input. However there should be a method to clear the input buffer?
Is this still relevant for you?
I'm not sure if this behavior of tb_peek_event() is intentional or not. I encountered it while attempting to make Tetris using termbox and trying to implement a time function and any inputs would stack rather than update on loop.
It can be replicated like this:
simply hold space and release when it shows 1.
#include <termbox.h>
#include <thread>
#include <chrono>
int main(void)
{
int i;
tb_init();
tb_cell c = {};
tb_event e = {};
while(i < 4)
{
tb_clear();
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
tb_peek_event(&e, 0);
if(e.key == TB_KEY_SPACE)
{
i++;
}
c.ch = 48 + i;
tb_put_cell(0,0,&c);
tb_present();
}
tb_shutdown();
return(0);
}