naev 0.12.5
joystick.c File Reference

Handles joystick initialization. More...

#include "joystick.h"
#include "log.h"
Include dependency graph for joystick.c:

Go to the source code of this file.

Functions

static void joystick_initHaptic (void)
 Initializes force feedback for the loaded device.
int joystick_get (const char *namjoystick)
 Gets the joystick index by name.
int joystick_use (int indjoystick)
 Makes the game use a joystick by index.
int joystick_init (void)
 Initializes the joystick subsystem.
void joystick_exit (void)
 Exits the joystick subsystem.

Variables

static SDL_Joystick * joystick = NULL
static int has_haptic = 0
SDL_Haptic * haptic = NULL
unsigned int haptic_query = 0

Detailed Description

Handles joystick initialization.

Definition in file joystick.c.

Function Documentation

◆ joystick_exit()

void joystick_exit ( void )

Exits the joystick subsystem.

Definition at line 171 of file joystick.c.

◆ joystick_get()

int joystick_get ( const char * namjoystick)

Gets the joystick index by name.

Parameters
namjoystickLooks for this string in the joystick name.
Returns
The index if found, defaults to 0 if it isn't found.

Definition at line 35 of file joystick.c.

◆ joystick_init()

int joystick_init ( void )

Initializes the joystick subsystem.

Returns
0 on success.

Definition at line 147 of file joystick.c.

◆ joystick_initHaptic()

void joystick_initHaptic ( void )
static

Initializes force feedback for the loaded device.

Definition at line 96 of file joystick.c.

◆ joystick_use()

int joystick_use ( int indjoystick)

Makes the game use a joystick by index.

Parameters
indjoystickIndex of the joystick to use.
Returns
0 on success.

Definition at line 54 of file joystick.c.

Variable Documentation

◆ haptic

SDL_Haptic* haptic = NULL

Current haptic in use, externed in spfx.c.

Definition at line 21 of file joystick.c.

◆ haptic_query

unsigned int haptic_query = 0

Properties of the haptic device.

Definition at line 22 of file joystick.c.

◆ has_haptic

int has_haptic = 0
static

Does the player have haptic?

Definition at line 20 of file joystick.c.

◆ joystick

SDL_Joystick* joystick = NULL
static

Current joystick in use.

Definition at line 19 of file joystick.c.