@@ -2431,7 +2431,18 @@ public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
24312431 /// </summary>
24322432 public class CabViewDigitalRenderer : CabViewControlRenderer
24332433 {
2434- readonly LabelAlignment Alignment ;
2434+ public enum CVDigitalAlignment
2435+ {
2436+ Left ,
2437+ Center ,
2438+ Right ,
2439+ // Next ones are used for 3D cabs; digitals of old 3D cab will continue to be displayed left aligned for compatibility
2440+ Cab3DLeft ,
2441+ Cab3DCenter ,
2442+ Cab3DRight
2443+ }
2444+
2445+ public readonly CVDigitalAlignment Alignment ;
24352446 string Format = "{0}" ;
24362447 readonly string Format1 = "{0}" ;
24372448 readonly string Format2 = "{0}" ;
@@ -2452,10 +2463,10 @@ public CabViewDigitalRenderer(Viewer viewer, MSTSLocomotive car, CVCDigital digi
24522463
24532464 // Clock defaults to centered.
24542465 if ( Control . ControlType == CABViewControlTypes . CLOCK )
2455- Alignment = LabelAlignment . Center ;
2456- Alignment = digital . Justification == 1 ? LabelAlignment . Center : digital . Justification == 2 ? LabelAlignment . Left : digital . Justification == 3 ? LabelAlignment . Right : Alignment ;
2466+ Alignment = CVDigitalAlignment . Center ;
2467+ Alignment = digital . Justification == 1 ? CVDigitalAlignment . Center : digital . Justification == 2 ? CVDigitalAlignment . Left : digital . Justification == 3 ? CVDigitalAlignment . Right : Alignment ;
24572468 // Used for 3D cabs
2458- Alignment = digital . Justification == 4 ? LabelAlignment . Cab3DCenter : digital . Justification == 5 ? LabelAlignment . Cab3DLeft : digital . Justification == 6 ? LabelAlignment . Cab3DRight : Alignment ;
2469+ Alignment = digital . Justification == 4 ? CVDigitalAlignment . Cab3DCenter : digital . Justification == 5 ? CVDigitalAlignment . Cab3DLeft : digital . Justification == 6 ? CVDigitalAlignment . Cab3DRight : Alignment ;
24592470 Format1 = "{0:0" + new String ( '0' , digital . LeadingZeros ) + ( digital . Accuracy > 0 ? "." + new String ( '0' , ( int ) digital . Accuracy ) : "" ) + "}" ;
24602471 Format2 = "{0:0" + new String ( '0' , digital . LeadingZeros ) + ( digital . AccuracySwitch > 0 ? "." + new String ( '0' , ( int ) ( digital . Accuracy + 1 ) ) : "" ) + "}" ;
24612472 }
@@ -2535,7 +2546,8 @@ public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
25352546
25362547 public override void Draw ( GraphicsDevice graphicsDevice )
25372548 {
2538- DrawFont . Draw ( ControlView . SpriteBatch , DrawPosition , Point . Zero , DrawRotation , DrawText , Alignment , DrawColor , Color . Black ) ;
2549+ var alignment = ( LabelAlignment ) Alignment ;
2550+ DrawFont . Draw ( ControlView . SpriteBatch , DrawPosition , Point . Zero , DrawRotation , DrawText , alignment , DrawColor , Color . Black ) ;
25392551 }
25402552
25412553 public string GetDigits ( out Color DrawColor )
@@ -2680,10 +2692,6 @@ public string GetDigits(out Color DrawColor)
26802692 return "" ;
26812693 }
26822694
2683- public LabelAlignment GetAlignment ( ) //used in 3D cab, to get alignment
2684- {
2685- return Alignment ;
2686- }
26872695 }
26882696
26892697 /// <summary>
@@ -3067,12 +3075,12 @@ public void UpdateDigit()
30673075 // add leading blanks to consider alignment
30683076 // for backwards compatibiliy with preceding OR releases all Justification values defined by MSTS are considered as left justified
30693077 var leadingBlankCount = 0 ;
3070- switch ( CVFR . GetAlignment ( ) )
3078+ switch ( CVFR . Alignment )
30713079 {
3072- case LabelAlignment . Cab3DRight :
3080+ case CabViewDigitalRenderer . CVDigitalAlignment . Cab3DRight :
30733081 leadingBlankCount = MaxDigits - speed . Length ;
30743082 break ;
3075- case LabelAlignment . Cab3DCenter :
3083+ case CabViewDigitalRenderer . CVDigitalAlignment . Cab3DCenter :
30763084 leadingBlankCount = ( MaxDigits - speed . Length + 1 ) / 2 ;
30773085 break ;
30783086 default :
0 commit comments