More often than I’d like (never) my input polling misses a key/mouse press. Now by this I don’t mean the mouse/keyboard listener events. I mean my Input/Keyboard/Mouse classes.
I have it setup so that when mousePressed() gets called I call my own function in Mouse sending a buttoncode over and store the result (true) in an array for that button (same idea for the keyboard). Every frame/update I call Input.update(). This takes the current key presses and puts them in another array “last_key_presses”. last_key_presses is the array I read from every frame to tell if a button/key was pressed.
I think the problem lies with the fact that a mouse press fires an event (on another thread) that gets wiped out when I call Input.update() on the main thread, but I’m not sure how to fix it.
Any ideas?