You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?
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);
}
The text was updated successfully, but these errors were encountered: