Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed more mistakes in documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Jul 7, 2008
1 parent 28cd9c7 commit f57909c
Showing 1 changed file with 46 additions and 29 deletions.
75 changes: 46 additions & 29 deletions include/SDL_haptic.h
Expand Up @@ -37,7 +37,6 @@
* - (optional) Free the effect with SDL_HapticDestroyEffect(...).
* - Close the haptic device with SDL_HapticClose(...).
*
*
* Example:
*
* \code
Expand All @@ -51,7 +50,7 @@
* if (haptic == NULL) return -1; // Most likely joystick isn't haptic
*
* // See if it can do sine waves
* if ((SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_SINE)==0) {
* if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
* SDL_HapticClose(haptic); // No sine effect
* return -1;
* }
Expand Down Expand Up @@ -100,7 +99,7 @@
/* *INDENT-OFF* */
extern "C" {
/* *INDENT-ON* */
#endif /* __cpluspuls */
#endif /* __cplusplus */

/**
* \typedef SDL_Haptic
Expand Down Expand Up @@ -270,8 +269,8 @@ typedef struct _SDL_Haptic SDL_Haptic;
* \brief Structure that represents a haptic direction.
*
* Directions can be specified by:
* - SDL_HAPTIC_POLAR: Specified by polar coordinates.
* - SDL_HAPTIC_CARTESIAN: Specified by cartesian coordinates.
* - SDL_HAPTIC_POLAR : Specified by polar coordinates.
* - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
*
* Cardinal directions of the haptic device are relative to the positioning
* of the device. North is considered to be away from the user.
Expand Down Expand Up @@ -345,6 +344,9 @@ typedef struct SDL_HapticDirection {
*
* The struct is exclusive to the SDL_HAPTIC_CONSTANT effect.
*
* A constant effect applies a constant force in the specified direction
* to the joystick.
*
* \sa SDL_HAPTIC_CONSTANT
* \sa SDL_HapticEffect
*/
Expand Down Expand Up @@ -382,6 +384,10 @@ typedef struct SDL_HapticConstant {
* - SDL_HAPTIC_SAWTOOTHUP
* - SDL_HAPTIC_SAWTOOTHDOWN
*
* A periodic effect consists in a wave-shaped effect that repeats itself
* over time. The type determines the shape of the wave and the parameters
* determine the dimensions of the wave.
*
* Examples:
* \code
* SDL_HAPTIC_SINE
Expand All @@ -400,28 +406,28 @@ typedef struct SDL_HapticConstant {
* / \/ \/ \/ \/
*
* SDL_HAPTIC_SAWTOOTHUP
* __ __ __ __ _
* / | / | / | / | /
* / | / | / | / | /
* / |/ |/ |/ |/
* /| /| /| /| /| /| /|
* / | / | / | / | / | / | / |
* / |/ |/ |/ |/ |/ |/ |
*
* SDL_HAPTIC_SAWTOOTHDOWN
* __ __ __ __ __
* \ | \ | \ | \ | \
* \ | \ | \ | \ | \
* \| \| \| \|
* \ |\ |\ |\ |\ |\ |\ |
* \ | \ | \ | \ | \ | \ | \ |
* \| \| \| \| \| \| \|
* \endcode
*
* \sa SDL_HAPTIC_SINE
* \sa SDL_HAPTIC_SQUARE
* \sa SDL_HAPTIC_TRIANGLE
* \sa SDL_HAPTIC_SAWTOOTHUP
* \sa SDL_HAPTIC SAWTOOTHDOWN
* \sa SDL_HAPTIC_SAWTOOTHDOWN
* \sa SDL_HapticEffect
*/
typedef struct SDL_HapticPeriodic {
/* Header */
Uint16 type; /**< SDL_HAPTIC_{SINE,SQUARE,TRIANGLE,SAWTOOTHUP,SAWTOOTHDOWN} */
Uint16 type; /**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE,
SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or
SDL_HAPTIC_SAWTOOTHDOWN */
SDL_HapticDirection direction; /**< Direction of the effect. */

/* Replay */
Expand Down Expand Up @@ -449,17 +455,19 @@ typedef struct SDL_HapticPeriodic {
*
* \brief A structure containing a template for a Condition effect.
*
* Direction is handled by condition internals instead of a direction member.
* Each of right_sat, lefT-sat, right_coeff, left_coeff, deadband and center
* have two parameters, first is for x value, second is for y value following
* the scheme set by SDL_HapticDirection.
*
* The struct handles the following effects:
* - SDL_HAPTIC_SPRING: Effect based on axes position.
* - SDL_HAPTIC_DAMPER: Effect based on axes velocity.
* - SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
* - SDL_HAPTIC_FRICTION: Effect based on axes movement.
*
* Direction is handled by condition internals instead of a direction member.
* The condition effect specific members have two parameters. The first
* refers to the X axis, the second refers to the Y axis. The right terms
* refer to the positive side of the axis and the left terms refer to the
* negative side of the axis. Please refer to the SDL_HapticDirection
* diagram for which side is positive and which is negative.
*
* \sa SDL_HapticDirection
* \sa SDL_HAPTIC_SPRING
* \sa SDL_HAPTIC_DAMPER
Expand All @@ -469,7 +477,8 @@ typedef struct SDL_HapticPeriodic {
*/
typedef struct SDL_HapticCondition {
/* Header */
Uint16 type; /**< SDL_HAPTIC_{SPRING,DAMPER,INERTIA,FRICTION} */
Uint16 type; /**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER,
SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION */

/* Replay */
Uint16 length; /**< Duration of the effect. */
Expand All @@ -480,10 +489,10 @@ typedef struct SDL_HapticCondition {
Uint16 interval; /**< How soon it can be triggered again after button. */

/* Condition */
Uint16 right_sat[2]; /**< Level when joystick is to the right. */
Uint16 left_sat[2]; /**< Level when joystick is to the left. */
Sint16 right_coeff[2]; /**< How fast to increase the force towards the right. */
Sint16 left_coeff[2]; /**< How fast to increase the force towards the left. */
Uint16 right_sat[2]; /**< Level when joystick is to the positive side. */
Uint16 left_sat[2]; /**< Level when joystick is to the negative side. */
Sint16 right_coeff[2]; /**< How fast to increase the force towards the positive side. */
Sint16 left_coeff[2]; /**< How fast to increase the force towards the negative side. */
Uint16 deadband[2]; /**< Size of the dead zone. */
Sint16 center[2]; /**< Position of the dead zone. */
} SDL_HapticCondition;
Expand All @@ -494,6 +503,11 @@ typedef struct SDL_HapticCondition {
*
* This struct is exclusively for the SDL_HAPTIC_RAMP effect.
*
* The ramp effect starts at start strength and ends at end strength.
* It augments in linear fashion. If you use attack and fade with a ramp
* they effects get added to the ramp effect making the effect become
* quadratic instead of linear.
*
* \sa SDL_HAPTIC_RAMP
* \sa SDL_HapticEffect
*/
Expand Down Expand Up @@ -526,7 +540,7 @@ typedef struct SDL_HapticRamp {
* \brief The generic template for any haptic effect.
*
* All values max at 32767 (0x7FFF). Signed values also can be negative.
* Time values unless specified otherwise are in milliseconds.
* Time values unless specified otherwise are in milliseconds.
*
* Common parts:
* \code
Expand All @@ -538,21 +552,21 @@ typedef struct SDL_HapticRamp {
* Uint16 button; // Button that triggers effect.
* Uint16 interval; // How soon before effect can be triggered again.
*
* // Envelope - Not all effects have this
* // Envelope - All effects except condition effects have this
* Uint16 attack_length; // Duration of the attack (ms).
* Uint16 attack_level; // Level at the start of the attack.
* Uint16 fade_length; // Duration of the fade out (ms).
* Uint16 fade_level; // Level at the end of the fade.
* \endcode
*
*
* Here we have an example of an effect evolution in time:
* Here we have an example of a constant effect evolution in time:
*
* \code
* Strength
* ^
* |
* | effect strength --> _________________
* | effect level --> _________________
* | / \
* | / \
* | / \
Expand All @@ -568,6 +582,9 @@ typedef struct SDL_HapticRamp {
* delay length
* \endcode
*
* Note either the attack_level or the fade_level may be above the actual
* effect level.
*
* \sa SDL_HapticConstant
* \sa SDL_HapticPeriodic
* \sa SDL_HapticCondition
Expand Down

0 comments on commit f57909c

Please sign in to comment.