This rule is fake. There is no rule that tells that a player can win by moving his king to some position. A game of chess is won by mating the king of the opponent. The computer game program I have allows a bishop to move horizontally. This is indeed an error of your program.
Bishops only can go diagonally.
I accidently left my king in check. I move an intervening piece that was protecting my king and inadvertantly exposed my king to the opponent's queen or rook or bishop. The opponent did not point out my king's vulnerablility at the time but moved, when it was his turn, to take my king. You did not lose the game. When a player makes an illegal move, and this is noted, the move must be undone, and the player must make another move.