Scylla Framework
  • API Reference
Search Results for

    Show / Hide Table of Contents
    • Scylla.Console.TextMode
      • IConsoleScreen
      • TextModeDebugConsoleDisplay
      • TicTacToeCommand
      • TicTacToeScreen
    • Scylla.TextMode
      • ANSIAttributeParser
      • ANSIColor
      • ANSISGRAttributes
      • AmbientEffectBase
      • BackgroundBlendMode
      • BoxStyle
      • BoxStyleCharacters
      • BoxStyleCharacters.BoxChars
      • CRTSettings
      • Cell
      • CellAttributes
      • CellAttributesExtensions
      • CellBuffer
      • CellBufferRenderer
      • CellGrid
      • CellMask
      • CellPosition
      • CellRange
      • CellRect
      • ColorCycleEffect
      • ColorCycleEffectPreset
      • CrossFadeEffect
      • CursorStyle
      • DecodeEffect
      • DecodeEffectPreset
      • DigitalRainEffect
      • DigitalRainEffectPreset
      • EffectsSettings
      • FadeEffect
      • FadeEffectPreset
      • FlickerEffect
      • FlickerEffectPreset
      • GlitchEffect
      • GlitchEffectPreset
      • GlyphAtlasCache
      • GridSettings
      • IAutoCompleter
      • IInputHistory
      • ITextEffect
      • ITextEffectContext
      • ITextModeGridProvider
      • ITextModePointerMapper
      • ITextModeRenderSource
      • ITextModeViewHost
      • IVTParserHandler
      • InputHistory
      • MaskTransitionEffect
      • MouseEncodingMode
      • MouseTrackingMode
      • PackedGlyphData
      • PulseEffect
      • PulseEffectPreset
      • PushEffect
      • PushEffectPreset
      • SDFSettings
      • ScrollbackAttributeRun
      • ScrollbackLine
      • ScyllaTextMode
      • ScyllaTextMode.Meta
      • ScyllaTextModeConfiguration
      • SlideInEffect
      • SlideInEffectPreset
      • StaticTuneInEffect
      • StaticTuneInEffectPreset
      • TerminalCLI
      • TerminalEmulator
      • TerminalGridRenderer
      • TerminalInputEncoder
      • TerminalMouseButton
      • TerminalScrollbackBuffer
      • TerminalSettings
      • TextAlignment
      • TextEffectBase
      • TextEffectCompletedEvent
      • TextEffectDirection
      • TextEffectExtensions
      • TextEffectMaskPattern
      • TextEffectPreset
      • TextEffectPushMode
      • TextEffectSequencer
      • TextEffectStartedEvent
      • TextEffectState
      • TextEffectTimeMode
      • TextEffects
      • TextModeCellBorder
      • TextModeColorDefaults
      • TextModeColorScheme
      • TextModeColorSet
      • TextModeConfigurationChangedEvent
      • TextModeConsole
      • TextModeConstants
      • TextModeEffectPlayer
      • TextModeGridCapture
      • TextModeLayoutUtil
      • TextModeMaterials
      • TextModeMouseReporter
      • TextModeMouseReportingEvent
      • TextModeSelectionChangedEvent
      • TextModeSelectionEndedEvent
      • TextModeSelectionManager
      • TextModeSelectionStartedEvent
      • TextModeTerminal
      • TextModeTerminalColorTheme
      • TextModeTerminalHost
      • TextModeTerminalSettings
      • TextModeTerminalStartMode
      • TextModeThemeBackground
      • TextModeThemeChangedEvent
      • TextModeThemeRemapper
      • TextModeThemes
      • TextModeView
      • TextWrapMode
      • ThemeSettings
      • TransitionEffectBase
      • TransitionEffectPreset
      • TwinkleEffect
      • TwinkleEffectPreset
      • TypewriterCharacterRevealedEvent
      • TypewriterEffect
      • TypewriterEffectPreset
      • UITextModeView
      • VTParser
      • WaveEffect
      • WaveEffectPreset
    • Scylla.TextMode.CRT
      • CRTBeam
      • CRTBeamClock
      • CRTBeamScanDirection
      • CRTBeamStatus
      • CRTCalibrationPattern
      • CRTCurvatureShape
      • CRTGeometry
      • CRTHDR
      • CRTHDRDisplay
      • CRTHDRTarget
      • CRTHorizontalKernel
      • CRTImageRegion
      • CRTMaskType
      • CRTQualityTier
      • CRTScaleMode
      • CRTSignalStandard
      • CRTSignalType
      • ITextModeCRTCameraEffect
      • ITextModeCRTHDRDisplaySource
      • TextModeCRTBeam
      • TextModeCRTCalibration
      • TextModeCRTCameraEffects
      • TextModeCRTConstants
      • TextModeCRTDriver
      • TextModeCRTHDR
      • TextModeCRTImageRenderer
      • TextModeCRTMonitor
      • TextModeCRTPreset
      • TextModeCRTPresetRegistry
      • TextModeCRTScreen
      • TextModeCRTSettings
      • TextModeCRTTube
    • Scylla.TextMode.Editor
      • CellGridPreviewWidget
      • ColorPaletteWidget
      • ITextModeCRTCameraSetupProvider
      • ScyllaTextModeConfigurationEditor
      • ScyllaTextModeDependencyProvider
      • ScyllaTextModeEditor
      • ScyllaTextModeMenuItems
      • ScyllaTextModeShaderProvider
      • TextModeCRTCameraSetup
      • TextModeCRTCameraStatus
      • TextModeCRTDriverEditor
      • TextModeCRTMonitorEditor
      • TextModeCRTPresetEditor
      • TextModeCRTPresetGenerator
      • TextModeColorAssetGenerator
      • TextModeColorPaletteDefaults
      • TextModeTerminalHostEditor
      • TextModeThemeField
      • TextModeViewEditor
      • TextModeViewEditorBase
      • UITextModeViewEditor
    • Scylla.TextMode.URP
      • CRTQualityTierParameter
      • TextModeCRTInjectionPoint
      • TextModeCRTPresetParameter
      • TextModeCRTRendererFeature
      • TextModeCRTVolume

    Class CRTBeamClock

    Counts display refreshes for the beam simulator and tells where the beam is: which CRT frame is showing and which part of it the current refresh covers.

    Inheritance
    object
    CRTBeamClock
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Scylla.TextMode.CRT
    Assembly: ScyllaTextMode.CRT.dll
    Syntax
    public sealed class CRTBeamClock
    Remarks

    The beam must advance once per display refresh, not per game frame. With vSync on, every Unity frame is one refresh. A frame that took longer than a refresh advances the count by the refreshes it spanned, so a missed refresh moves the beam on instead of stalling it.

    The clock does not read the display or the configuration; the caller sets the rates with SetRates(double, double, bool) and advances it once per frame with Advance(float).

    The count only ever grows until Reset(). CycleIndex and Window are worked out from it, so the beam position follows from the count alone. TextModeCRTBeam owns the shared instance that every CRT picture reads; the class is public so tests can drive their own.

    Properties

    AntiRetention

    Gets whether an even number of refreshes per CRT frame drifts slowly, for LCDs.

    Declaration
    public bool AntiRetention { get; }
    Property Value
    Type Description
    bool

    CRTRate

    Gets the simulated CRT's refresh rate in hertz.

    Declaration
    public double CRTRate { get; }
    Property Value
    Type Description
    double

    CanRun

    Gets whether the simulator can run: at least MIN_FRAMES refreshes per CRT frame.

    Declaration
    public bool CanRun { get; }
    Property Value
    Type Description
    bool

    CycleIndex

    Gets the index of the CRT frame showing now. It changes when a new source frame is due. While the clock cannot run it equals Refreshes.

    Declaration
    public long CycleIndex { get; }
    Property Value
    Type Description
    long

    DisplayRate

    Gets the display refresh rate in hertz the clock counts with.

    Declaration
    public double DisplayRate { get; }
    Property Value
    Type Description
    double

    Frames

    Gets the display refreshes per CRT frame, including the anti-retention drift, or 0 when the simulator cannot run at the set rates.

    Declaration
    public float Frames { get; }
    Property Value
    Type Description
    float

    MissedRefreshes

    Gets the number of refreshes that passed without a frame, counted since the clock started or was reset. A steady rise means the game does not keep up with the display.

    Declaration
    public long MissedRefreshes { get; }
    Property Value
    Type Description
    long

    Refreshes

    Gets the number of display refreshes counted since the clock started or was reset.

    Declaration
    public long Refreshes { get; }
    Property Value
    Type Description
    long

    SlowMotionDivisor

    Gets or sets how many frames each refresh step lasts, for watching the sweep on a slow display. 1, the default, runs at the real rate. A development aid only. Values below 1 are raised to 1.

    Declaration
    public int SlowMotionDivisor { get; set; }
    Property Value
    Type Description
    int

    Window

    Gets where the current refresh starts within the CRT frame, in refreshes, from 0 up to but not including Frames. 0 while the clock cannot run.

    Declaration
    public float Window { get; }
    Property Value
    Type Description
    float

    Methods

    Advance(float)

    Advances the clock by one frame.

    Declaration
    public int Advance(float deltaTime)
    Parameters
    Type Name Description
    float deltaTime

    The unscaled time the frame took, in seconds.

    Returns
    Type Description
    int

    The number of refreshes the frame advanced by, 0 while slow motion holds.

    Remarks

    A frame that spans more than one refresh adds the extra refreshes to MissedRefreshes. With slow motion on, the frame time is ignored and the clock steps one refresh every SlowMotionDivisor frames, without counting missed refreshes. Nothing happens while CanRun is false.

    Reset()

    Starts counting from zero again, with the rates kept.

    Declaration
    public void Reset()

    SetRates(double, double, bool)

    Sets the rates the clock counts with. The count keeps running, so the beam does not jump when the rates are set again with the same values.

    Declaration
    public void SetRates(double displayRate, double crtRate, bool antiRetention)
    Parameters
    Type Name Description
    double displayRate

    The display's refresh rate in hertz.

    double crtRate

    The simulated CRT's refresh rate in hertz, such as 60.

    bool antiRetention

    Whether an even number of refreshes per CRT frame drifts, for LCDs.

    ShaderVector(float, CRTBeamScanDirection)

    Returns the shader vector for the composite's beam stage at the current refresh.

    Declaration
    public Vector4 ShaderVector(float gain, CRTBeamScanDirection direction)
    Parameters
    Type Name Description
    float gain

    The share of the value emitted on average.

    CRTBeamScanDirection direction

    The scan direction.

    Returns
    Type Description
    Vector4

    The vector for _CrtBeamSim; all zero when the simulator cannot run.

    In this article
    Back to top Scylla Framework - TextMode Module API Documentation