More documentation for input/input_joypad.c

This commit is contained in:
twinaphex 2015-01-10 20:48:26 +01:00
parent 34bf60cf51
commit e707c401c8
2 changed files with 76 additions and 0 deletions

View File

@ -41,6 +41,17 @@ const char *input_joypad_name(const rarch_joypad_driver_t *drv,
return drv->name(port);
}
/**
* input_joypad_set_rumble:
* @drv : Joypad driver handle.
* @port : User number.
* @effect : Rumble effect to set.
* @strength : Strength of rumble effect.
*
* Sets rumble effect @effect with strength @strength.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool input_joypad_set_rumble(const rarch_joypad_driver_t *drv,
unsigned port, enum retro_rumble_effect effect, uint16_t strength)
{
@ -125,6 +136,25 @@ bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
return true;
}
/**
* input_joypad_analog:
* @drv : Joypad driver handle.
* @port : User number.
* @idx : Analog key index.
* E.g.:
* - RETRO_DEVICE_INDEX_ANALOG_LEFT
* - RETRO_DEVICE_INDEX_ANALOG_RIGHT
* @ident : Analog key identifier.
* E.g.:
* - RETRO_DEVICE_ID_ANALOG_X
* - RETRO_DEVICE_ID_ANALOG_Y
* @binds : Binds of user.
*
* Gets analog value of analog key identifiers @idx and @ident
* from user with number @port with provided keybinds (@binds).
*
* Returns: analog value on success, otherwise 0.
**/
int16_t input_joypad_analog(const rarch_joypad_driver_t *drv,
unsigned port, unsigned idx, unsigned ident,
const struct retro_keybind *binds)

View File

@ -24,6 +24,22 @@ extern "C" {
#include <stdint.h>
#include "../driver.h"
/**
* input_conv_analog_id_to_bind_id:
* @idx : Analog key index.
* E.g.:
* - RETRO_DEVICE_INDEX_ANALOG_LEFT
* - RETRO_DEVICE_INDEX_ANALOG_RIGHT
* @ident : Analog key identifier.
* E.g.:
* - RETRO_DEVICE_ID_ANALOG_X
* - RETRO_DEVICE_ID_ANALOG_Y
* @ident_minus : Bind ID minus, will be set by function.
* @ident_plus : Bind ID plus, will be set by function.
*
* Takes as input analog key identifiers and converts
* them to corresponding bind IDs @ident_minus and @ident_plus.
**/
static inline void input_conv_analog_id_to_bind_id(unsigned idx, unsigned ident,
unsigned *ident_minus, unsigned *ident_plus)
{
@ -67,10 +83,40 @@ static inline void input_conv_analog_id_to_bind_id(unsigned idx, unsigned ident,
bool input_joypad_pressed(const rarch_joypad_driver_t *driver,
unsigned port, const struct retro_keybind *binds, unsigned key);
/**
* input_joypad_analog:
* @drv : Joypad driver handle.
* @port : User number.
* @idx : Analog key index.
* E.g.:
* - RETRO_DEVICE_INDEX_ANALOG_LEFT
* - RETRO_DEVICE_INDEX_ANALOG_RIGHT
* @ident : Analog key identifier.
* E.g.:
* - RETRO_DEVICE_ID_ANALOG_X
* - RETRO_DEVICE_ID_ANALOG_Y
* @binds : Binds of user.
*
* Gets analog value of analog key identifiers @idx and @ident
* from user with number @port with provided keybinds (@binds).
*
* Returns: analog value on success, otherwise 0.
**/
int16_t input_joypad_analog(const rarch_joypad_driver_t *driver,
unsigned port, unsigned idx, unsigned ident,
const struct retro_keybind *binds);
/**
* input_joypad_set_rumble:
* @drv : Joypad driver handle.
* @port : User number.
* @effect : Rumble effect to set.
* @strength : Strength of rumble effect.
*
* Sets rumble effect @effect with strength @strength.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool input_joypad_set_rumble(const rarch_joypad_driver_t *driver,
unsigned port, enum retro_rumble_effect effect, uint16_t strength);