SDL_JoystickOpen



SDL_JoystickOpen

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLES
SEE ALSO

NAME

SDL_JoystickOpen − Opens a joystick for use.

SYNOPSIS

#include "SDL.h"

SDL_Joystick *SDL_JoystickOpen(int index);

DESCRIPTION

Opens a joystick for use within SDL. The index refers to the N’th joystick in the system. A joystick must be opened before it game be used.

RETURN VALUE

Returns a SDL_Joystick structure on success. NULL on failure.

EXAMPLES

SDL_Joystick *joy;
// Check for joystick
if(SDL_NumJoysticks()>0){
  // Open joystick
  joy=SDL_JoystickOpen(0);

  if(joy)
  {
    printf("Opened Joystick 0
");
    printf("Name: %s
", SDL_JoystickName(0));
    printf("Number of Axes: %d
", SDL_JoystickNumAxes(joy));
    printf("Number of Buttons: %d
", SDL_JoystickNumButtons(joy));
    printf("Number of Balls: %d
", SDL_JoystickNumBalls(joy));
  }
  else
    printf("Couldn’t open Joystick 0
");


  // Close if opened
  if(SDL_JoystickOpened(0))
    SDL_JoystickClose(joy);
}

SEE ALSO

SDL_JoystickClose



More Linux Commands

manpages/wcsncasecmp.3.html
wcsncasecmp(3) - compare two fixed-size wide-character strin
The wcsncasecmp() function is the wide-character equivalent of the strncasecmp(3) function. It compares the wide-character string pointed to by s1 and the wide-

manpages/getline.3.html
getline(3) - delimited string input - Linux manual page.....
getline() reads an entire line from stream, storing the address of the buffer containing the text into *lineptr. The buffer is null-terminated and includes the

manpages/gnutls_x509_privkey_import_dsa_raw.3.html
gnutls_x509_privkey_import_dsa_raw(3) - API function........
This function will convert the given DSA raw parameters to the native gnutls_x509_privkey_t format. The output will be stored in key. RETURNS On success, GNUTLS

manpages/intel_bios_dumper.1.html
intel_bios_dumper(1) - Saves the Intel video BIOS contents t
intel_bios_dumper is a tool to save the contents of the Intel video BIOS to a file. It can then be parsed offline for debugging issues with the video bios table

manpages/XUndefineCursor.3.html
XUndefineCursor(3) - define cursors - Linux manual page.....
If a cursor is set, it will be used when the pointer is in the window. If the cursor is None, it is equivalent to XUndefineCursor. XDefineCursor can generate Ba

manpages/makeinfo.1.html
makeinfo(1) - translate Texinfo documents - Linux man page
Translate Texinfo source documentation to various other formats, by default Info files suitable for reading online with Emacs or standalone GNU Info. General op

manpages/systemd.1.html
systemd(1) - systemd System and Service Manager (Man Page)
systemd is a system and service manager for Linux operating systems. When run as first process on boot (as PID 1), it acts as init system that brings up and mai

manpages/gluBeginCurve.3gl.html
gluBeginCurve(3gl) - delimit a NURBS curve definition.......
Use gluBeginCurve to mark the beginning of a NURBS curve definition. After calling gluBeginCurve, make one or more calls to gluNurbsCurve to define the attribut

manpages/ber_put_string.3.html
ber_put_string(3) - OpenLDAP LBER simplified Basic Encoding
These routines provide a subroutine interface to a simplified implementation of the Basic Encoding Rules of ASN.1. The version of BER these routines support is

manpages/glGetTexParameter.3gl.html
glGetTexParameter(3gl) - return texture parameter values....
glGetTexParameter returns in params the value or values of the texture parameter specified as pname. target defines the target texture, either GL_TEXTURE_1D, GL

manpages/move_panel.3curses.html
move_panel(3curses) - panel stack extension for curses......
Panels are ncurses(3NCURSES) windows with the added feature of depth. Panel functions allow the use of stacked windows and ensure the proper portions of each wi

manpages/gnutls_anon_allocate_client_credentials.3.html
gnutls_anon_allocate_client_credentials(3) - API function...
gnutls_anon_allocate_client_credentials.3 - This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate i





We can't live, work or learn in freedom unless the software we use is free.