at.wisch.joystick.ffeffect
Class ConstantEffect

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

public class ConstantEffect
extends ExtendedEffect

The Class ConstantEffect. The most simple type of effect. It has a constant level of strength, and optional fade-in and fade-out.

Here we have an example of a constant effect evolution in time:

 Strength
 ˆ
 |
 |    effect level -->  _________________
 |                     /                 \
 |                    /                   \
 |                   /                     \
 |                  /                       \
 | attack level --> |                        \
 |                  |                        |  <---  fade level
 |                  |                        |
 +--------------------------------------------------> Time
                    [--]                 [---]
                attack length          fade length
 
 [-----------------][------------------------]
        delay                length
 
Note that either the attack level or the fade level may be above the effect level.

Author:
Martin Wischenbart
See Also:
Effect, Direction

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
ConstantEffect()
          Instantiates a new ConstantEffect with default parameters.
ConstantEffect(Direction direction, int effectLength, int effectDelay, int buttonIndex, int buttonInterval, int attackLength, int fadeLength, int attackLevel, int fadeLevel, int level)
          Instantiates a new ConstantEffect with the specified parameters.
 
Method Summary
 int getLevel()
          Gets the level (the strength) of the effect.
 java.lang.String getName()
          Gets the effect type as a String.
 int getStrength()
          Gets the strength.
 void setLevel(int level)
          Sets the level (the strength) 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, setEffectLength
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantEffect

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

Parameters:
direction - a Direction object
effectLength - the effect length in ms (or INFINITE_LENGTH)
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
level - the level (the strength) of the effect
See Also:
ConstantEffect()

ConstantEffect

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

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

getLevel

public int getLevel()
Gets the level (the strength) of the effect.

Returns:
the level (strength) of the effect
See Also:
setLevel(int)

setLevel

public void setLevel(int level)
Sets the level (the strength) of the effect.

Parameters:
level - the new level (strength) of the effect (an int from MIN_LEVEL (-32768) to MAX_LEVEL (32767))
See Also:
getLevel()

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 ConstantEffect refers to the level.

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

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 ConstantEffect refers to the level.

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

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: "Constant"
See Also:
Effect.getEffectType()