title: How to use a joystick from SDL on a Mac?
body: <p>The source is very basic:</p>
  
  <pre><code>#include &lt;SDL.h&gt;
  
  int main(int argc, char *argv[])
  {
    if (SDL_Init(SDL_INIT_JOYSTICK))
    {
      return 1;
    }
    int num_joy, i;
    num_joy=SDL_NumJoysticks();
    printf("%d joysticks found\n", num_joy);
    for(i=0;i&lt;num_joy;i++)
        printf("%s\n", SDL_JoystickName(i));
  
    SDL_Quit();
    return 0;
  }
  </code></pre>
  
  <p>This outputs the names of connected joysticks on Ubuntu 12.04, but not on my Mavericks Mac, with SDL 1.2.15, installed from Homebrew. Running it as root makes no difference. I assuming at this point that this is just a bug in SDL, but I'd love to be shown that I'm doing something wrong here.</p>
  
  <p>Source here: <a href="https://github.com/mikepurvis/joystick_sdl" rel="nofollow">https://github.com/mikepurvis/joystick_sdl</a></p>