WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
AnalogToyValueEffect.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
7 
8 namespace DirectOutput.FX.AnalogToyFX
9 {
16  {
17 
18  private AnalogAlpha _ActiveValue = new AnalogAlpha(255, 255);
19 
26  public AnalogAlpha ActiveValue
27  {
28  get { return _ActiveValue; }
29  set { _ActiveValue = value; }
30  }
31 
32  private AnalogAlpha _InactiveValue = new AnalogAlpha(0, 0);
33 
40  public AnalogAlpha InactiveValue
41  {
42  get { return _InactiveValue; }
43  set { _InactiveValue = value; }
44  }
45 
46 
47  private FadeModeEnum _FadeMode = FadeModeEnum.Fade;
48 
55  public FadeModeEnum FadeMode
56  {
57  get { return _FadeMode; }
58  set { _FadeMode = value; }
59  }
60 
61 
66  public override void Trigger(Table.TableElementData TableElementData)
67  {
68  if (Layer != null)
69  {
70  int FadeValue = TableElementData.Value;
71  if (FadeMode == FadeModeEnum.OnOff && FadeValue > 0) { FadeValue = 255; }
72 
73  Layer.Value = InactiveValue.Value + (int)((float)(ActiveValue.Value - InactiveValue.Value) * FadeValue / 255).Limit(0, 255);
74  Layer.Alpha = InactiveValue.Alpha + (int)((float)(ActiveValue.Alpha - InactiveValue.Alpha) * FadeValue / 255).Limit(0, 255);
75 
76  }
77  }
78 
79 
84  public override void Init(Table.Table Table)
85  {
86  base.Init(Table);
87  }
88 
92  public override void Finish()
93  {
94  base.Finish();
95  }
96 
97  }
98 
99 }
The namespace DirectOutput.Cab.Toys contains all toy related classes.
This effect controlls sets the value and alpha channel of a analog alpha toy based on the trigger val...
Object containing a analog value (0-255) and a alpha value (0-255).
Definition: AnalogAlpha.cs:11
override void Init(Table.Table Table)
Initializes the effect.
The namespace DirectOutput.Cab contains all cabinet related classes like the Cabinet class itself...
Definition: Cab.cs:16
override void Trigger(Table.TableElementData TableElementData)
Triggers the effect with the given TableElementData.
FadeModeEnum
Defines the fading behaviour.
Definition: FadeModeEnum.cs:11
override void Finish()
Finish does all necessary cleanupwork before the effect is discarded.
Base class for effects controlling a single AnalogToy object.
Namespace for objects dealing with layers
The namespace DirectOutput.General contains classes for general use.