Class TextModeCRTTube
The physical state of a CRT: whether it is switched on, a running degauss, and the burn-in it has collected. Switching it off collapses the picture into a line and then a dot; switching it on lets it warm up.
Inherited Members
Namespace: Scylla.TextMode.CRT
Assembly: ScyllaTextMode.CRT.dll
Syntax
public sealed class TextModeCRTTube
Remarks
Every TextModeCRTDriver has one in Tube. For the camera effect, create one and pass it to Show(Camera, TextModeCRTSettings, CRTQualityTier, bool, int, TextModeCRTTube). The tube keeps the time each event started and works out its look from the real time, so it plays the same at any frame rate, keeps running while the game is paused, and can be shared between views.
The events are raised the moment a change is asked for, which is when a game would play the matching sound: the click of the switch, the high voltage settling, or the thump of a degauss. When the TextMode configuration asks to reduce motion, switching on and off becomes a plain fade and a degauss shows nothing, but the events are still raised.
The tube passes through three states. While it is on, the picture shows at full brightness, or fades in during the warm-up after PowerOn(). After PowerOff() the picture collapses vertically into a bright line, the line shrinks horizontally into a dot, and the dot fades until IsDark turns true. A degauss can run on top of any of these. The tube only stores start times and flags; the driver or camera effect asks it what the picture looks like each frame.
The following example creates a tube that starts switched off, plays a sound when it switches on, and degausses it after it has warmed up. The same instance can be assigned to Tube or passed to a camera effect to share it.
var tube = new TextModeCRTTube(false);
tube.PoweredOn += () => Debug.Log("Click, the tube is on.");
tube.Degaussed += () => Debug.Log("Thump, degauss.");
tube.PowerOn();
/* Later, for example when the player presses a button. */
tube.Degauss();
tube.PowerOff();
Constructors
TextModeCRTTube(bool)
Creates a tube.
Declaration
public TextModeCRTTube(bool isPowered = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isPowered | Whether the tube starts switched on. A tube that starts on shows the picture at once, without a warm-up. A tube that starts off is dark until PowerOn() is called. |
Properties
IsDark
Gets whether the tube is switched off and the last of the picture has faded. It stays false during the collapse and the fading dot, so a game can wait for it before it removes the view.
Declaration
public bool IsDark { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPowered
Gets whether the tube is switched on. It turns false the moment PowerOff() is called, while the picture is still collapsing.
Declaration
public bool IsPowered { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
ClearBurnIn()
Removes the burn-in the tube has collected. The pass chains that draw with this tube notice the call the next time they render and clear their burn-in then.
Declaration
public void ClearBurnIn()
Degauss()
Degausses the tube: for about two seconds the picture wobbles and colored patches swirl across it, dying away as the degauss coil's field decays. A monochrome tube only wobbles.
Declaration
public void Degauss()
PowerOff()
Switches the tube off. The picture collapses into a bright horizontal line, the line shrinks into a dot, and the dot fades. Does nothing when the tube is already off.
Declaration
public void PowerOff()
PowerOn()
Switches the tube on. The picture fades in, blurred at first, over WarmUpTime. Does nothing when the tube is already on.
Declaration
public void PowerOn()
Events
Degaussed
Raised each time Degauss() is called. A new degauss restarts one that is still running.
Declaration
public event Action Degaussed
Event Type
| Type | Description |
|---|---|
| Action |
PoweredOff
Raised when the tube is switched off, at the moment PowerOff() is called and before the picture has collapsed. It is not raised when the tube is already off.
Declaration
public event Action PoweredOff
Event Type
| Type | Description |
|---|---|
| Action |
PoweredOn
Raised when the tube is switched on, at the moment PowerOn() is called and before the warm-up finishes. It is not raised when the tube is already on.
Declaration
public event Action PoweredOn
Event Type
| Type | Description |
|---|---|
| Action |