/* 
 *  call-seq:
 *    key_name(sym) -> string
 *
 *  Given the sym of a key, returns a printable representation.  This
 *  differs from key2str in that this will return a printable string
 *  for any key, even non-printable keys such as the arrow keys.
 *
 *  This method may raise SDLError if the SDL video subsystem could
 *  not be initialized for some reason.
 *
 *  Example:
 *    Rubygame.key_name( Rubygame::K_A )       # => "a"
 *    Rubygame.key_name( Rubygame::K_RETURN )  # => "return"
 *    Rubygame.key_name( Rubygame::K_LEFT )    # => "left"
 */
VALUE rbgm_keyname(VALUE self, VALUE sym)
{
        /* SDL_GetKeyName only works when video system has been initialized. */
        if( init_video_system() == 0 )
        {
                SDLKey key = NUM2INT(sym);
                char *result = SDL_GetKeyName(key);
                return rb_str_new2(result);           
        }
        else
        {
                rb_raise(eSDLError,"Could not initialize SDL video subsystem.");
                return Qnil;
        }
}