if (IsActive) { // The game window is active (or focused). } else { // The game window is not active. }