C++ virtual keystroke delay
I have some code that is supposed to hit space when a red line runs over a white square. I have timed the whole function and it takes 3-4 milliseconds per loop. I also save every screen capture that is taken so I know exactly what each frame looks like and the one that the program triggers on, ie red line over white square. This is off loaded to a thread and the main loop only takes 40 microseconds or so to call it so that its not delaying the program. The Issue is that the frame that the program triggers the key press on is correct every time. However, the time that the keystroke registers in the video is delayed by 20-40 ish milliseconds. This is causing it to hit late occasionally.