at.wisch.joystick.ffeffect
Class RampEffect

java.lang.Object
  extended by at.wisch.joystick.ffeffect.Effect
      extended by at.wisch.joystick.ffeffect.ExtendedEffect
          extended by at.wisch.joystick.ffeffect.RampEffect

public class RampEffect
extends ExtendedEffect

The Class RampEffect. RampEffect is similar to ConstantEffect, but it has different levels at beginning and end: it linearly increases or decreases the level.

Note: If you use attack and fade with a RampEffect the effects get added to the ramp effect making the effect become quadratic instead of linear.

Author:
Martin Wischenbart
See Also:
ConstantEffect

Field Summary
 
Fields inherited from class at.wisch.joystick.ffeffect.Effect
EFFECT_CONSTANT, EFFECT_CUSTOM, EFFECT_DAMPER, EFFECT_FRICTION, EFFECT_INERTIA, EFFECT_RAMP, EFFECT_SAWTOOHDOWN, EFFECT_SAWTOOTHUP, EFFECT_SINE, EFFECT_SPRING, EFFECT_SQUARE, EFFECT_TRIANGLE, INFINITE_LENGTH, MAX_DELAY, MAX_LENGTH, MAX_LEVEL, MIN_LEVEL, NO_BUTTON
 
Constructor Summary
RampEffect()
          Instantiates a new RampEffect with default parameters.
RampEffect(Direction direction, int effectLength, int effectDelay, int buttonIndex, int buttonInterval, int attackLength, int fadeLength, int attackLevel, int fadeLevel, int startLevel, int endLevel)
          Instantiates a new RampEffect with the specified parameters.
 
Method Summary
 int getEndLevel()
          Gets the level (the strength) at the end of the effect.
 java.lang.String getName()
          Gets the effect type as a String.
 int getStartLevel()
          Gets the level (the strength) of the effect at the beginning.
 int getStrength()
          Gets the strength.
 void setEffectLength(int effectLength)
          Sets the effect length in ms.
 void setEndLevel(int endLevel)
          Sets the level (the strength) at the end of the effect.
 void setStartLevel(int startLevel)
          Sets the level (the strength) at the beginning of the effect.
 void setStrength(int strength)
          Sets the strength for an effect.
 
Methods inherited from class at.wisch.joystick.ffeffect.ExtendedEffect
getAttackLength, getAttackLevel, getDirection, getFadeLength, getFadeLevel, setAttackLength, setAttackLevel, setDirection, setFadeLength, setFadeLevel
 
Methods inherited from class at.wisch.joystick.ffeffect.Effect
getButtonIndex, getButtonInterval, getDefaultDirection, getEffectDelay, getEffectLength, getEffectType, setButtonIndex, setButtonInterval, setDefaultDirection, setEffectDelay
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RampEffect

public RampEffect(Direction direction,
                  int effectLength,
                  int effectDelay,
                  int buttonIndex,
                  int buttonInterval,
                  int attackLength,
                  int fadeLength,
                  int attackLevel,
                  int fadeLevel,
                  int startLevel,
                  int endLevel)
Instantiates a new RampEffect with the specified parameters.

Parameters:
direction - a Direction object
effectLength - the effect length in ms
effectDelay - the delay before the effect starts in ms
buttonIndex - the trigger button index (or NO_BUTTON)
buttonInterval - the trigger button interval in ms
attackLength - the attack length (fade-in) in ms
fadeLength - the fade length (fade-out) in ms
attackLevel - the level from where to start the fade-in
fadeLevel - the level where the fade-out fades to
startLevel - the level (the strength) at the beginning of the effect
endLevel - the level (the strength) at the end of the effect
See Also:
RampEffect()

RampEffect

public RampEffect()
Instantiates a new RampEffect with default parameters.

See Also:
RampEffect(Direction, int, int, int, int, int, int, int, int, int, int)
Method Detail

setEffectLength

public void setEffectLength(int effectLength)
Sets the effect length in ms. RampEffect does not support INFINITE_LENGTH.

Overrides:
setEffectLength in class Effect
Parameters:
effectLength - the new effect length (an int from 0 to MAX_LENGTH (360000000 ms ))
See Also:
Effect.getEffectLength()

getName

public java.lang.String getName()
Gets the effect type as a String.

Specified by:
getName in class Effect
Returns:
the effect type as a String: "Ramp"
See Also:
Effect.getEffectType()

getStartLevel

public int getStartLevel()
Gets the level (the strength) of the effect at the beginning.

Returns:
the level (strength) of the effect at the beginning
See Also:
setStartLevel(int), getEndLevel()

setStartLevel

public void setStartLevel(int startLevel)
Sets the level (the strength) at the beginning of the effect.

Parameters:
startLevel - the new level (strength) at the beginning of the effect (an int from MIN_LEVEL (-32768) to MAX_LEVEL (32767))
See Also:
getStartLevel(), setEndLevel(int)

getEndLevel

public int getEndLevel()
Gets the level (the strength) at the end of the effect.

Returns:
the level (strength) at the end of the effect
See Also:
setEndLevel(int), getStartLevel()

setEndLevel

public void setEndLevel(int endLevel)
Sets the level (the strength) at the end of the effect.

Parameters:
endLevel - the new level (strength) at the end of the effect (an int from MIN_LEVEL (-32768) to MAX_LEVEL (32767))
See Also:
getEndLevel(), setStartLevel(int)

getStrength

public int getStrength()
Gets the strength. The strength tells us about the intensity of an effect. Depending on the type of effect the strength is computed differently. If you know the type of effect, use the effect specific methods instead. Strength for a RampEffect refers to the end level.

Specified by:
getStrength in class Effect
Returns:
the strength
See Also:
getEndLevel()

setStrength

public void setStrength(int strength)
Sets the strength for an effect. Every kind of effect has some way to set its strength or intensity. This is for convenience only, so we can use FFJoystick.getSimpleEffect() and later set strength without knowing what type of effect we actually have. If you know the type of effect, use the effect specific methods instead. Strength for a RampEffect refers to the end level.

Specified by:
setStrength in class Effect
Parameters:
strength - the new strength (an int from 0 to MAX_LEVEL (32767))
See Also:
setEndLevel(int)