I've got pausing working. If you pause in the game you can unpause, and the game also automatically pauses when the window is unfocused. However, if i try to unfocus the window when the game has been paused "internally"(not by unfocusing) the window sort of lags and switches to how it looked a few frames before pausing. This only affects visuals and doesn't actually unpause the game, but it makes it very hard to tell whether the game is paused or not. Is there any easy way to fix this?