code: func (j *Driver) handleEvent(event sdl.Event) error {
  	switch data := event.(type) {
  	case *sdl.JoyAxisEvent:
  		if data.Which == j.adaptor().joystick.InstanceID() {
  			axis := j.findName(data.Axis, j.config.Axis)
  			if axis == "" {
  				return fmt.Errorf("Unknown Axis: %v", data.Axis)
  			}
  			j.Publish(j.Event(axis), data.Value)
  		}
  	case *sdl.JoyButtonEvent:
  		if data.Which == j.adaptor().joystick.InstanceID() {
  			button := j.findName(data.Button, j.config.Buttons)
  			if button == "" {
  				return fmt.Errorf("Unknown Button: %v", data.Button)
  			}
  			if data.State == 1 {
  				j.Publish(j.Event(fmt.Sprintf("%s_press", button)), nil)
  			} else {
  				j.Publish(j.Event(fmt.Sprintf("%s_release", button)), nil)
  			}
  		}
  	case *sdl.JoyHatEvent:
  		if data.Which == j.adaptor().joystick.InstanceID() {
  			hat := j.findHatName(data.Value, data.Hat, j.config.Hats)
  			if hat == "" {
  				return fmt.Errorf("Unknown Hat: %v %v", data.Hat, data.Value)
  			} else if hat == "released" {
  				hat = previousHat
  				j.Publish(j.Event(fmt.Sprintf("%s_release", hat)), true)
  			} else {
  				previousHat = hat
  				j.Publish(j.Event(fmt.Sprintf("%s_press", hat)), true)
  			}
  		}
  	}
  	return nil
  }
docs: // HandleEvent publishes an specific event according to data received