Added support for scan codes (adapted from SDL).