veandco / go-sdl2-examples

This is where all go-sdl2 examples are stored
91 stars 34 forks source link

Add example for haptics #1

Closed malashin closed 6 years ago

malashin commented 6 years ago

Example output:

Looking for haptic devices...

Haptic device 0: Logitech G27 Racing Wheel USB
  Can store 128 effects
  Can play 128 effects at the same time
  Supported effects:
    constant
    sine
    triangle
    sawtoothup
    sawtoothdown
    ramp
    friction
    spring
    damper
    inertia
    custom
  Supported capabilities:
    gain
    status
    pause
  Creating new haptic effects on the specified device...
    effect 0: HAPTIC_CONSTANT
    effect 1: HAPTIC_SINE
    effect 2: HAPTIC_TRIANGLE
    effect 3: HAPTIC_SAWTOOTHUP
    effect 4: HAPTIC_SAWTOOTHDOWN
    effect 5: HAPTIC_SPRING
    Haptic error Unable to create effect
    effect 5: HAPTIC_RAMP
  Now playing effects for 5 seconds each with 1 second delay between
    playing effect 0
    playing effect 1
    playing effect 2
    playing effect 3
    playing effect 4
    playing effect 5

Haptic device 1: XInput Controller #1
  Can store 1 effects
  Can play 1 effects at the same time
  Supported effects:
    left/right
  Supported capabilities:
  Creating new haptic effects on the specified device...
    effect 0: HAPTIC_LEFTRIGHT
  Now playing effects for 5 seconds each with 1 second delay between
    playing effect 0
veeableful commented 6 years ago

I don't have any haptic device to try this one so you can merge this PR yourself :grimacing:

I invited you to become collaborator.