@@ -82,7 +82,7 @@ public class DistributedPowerInterface
8282 /// </summary>
8383 public bool IsSoftLayout ;
8484 public DPIWindow ActiveWindow ;
85- public DistributedPowerInterface ( float height , float width , MSTSLocomotive locomotive , Viewer viewer , CabViewControl control )
85+ public DistributedPowerInterface ( float height , float width , MSTSLocomotive locomotive , Viewer viewer , CVCScreen control )
8686 {
8787 Viewer = viewer ;
8888 Locomotive = locomotive ;
@@ -172,7 +172,7 @@ public DPDefaultWindow(DistributedPowerInterface dpi, CabViewControl control) :
172172 sUnits = sUnits . Replace ( '/' , '_' ) ;
173173 CABViewControlUnits . TryParse ( sUnits , out LoadUnits ) ;
174174 }
175- DPITable = new DPITable ( FullTable , LoadUnits , fullScreen : true , dpi : dpi ) ;
175+ DPITable = new DPITable ( FullTable , LoadUnits , fullScreen : true , dpi : dpi , ( control as CVCScreen ) . Rotation ) ;
176176 AddToLayout ( DPITable , new Point ( 0 , 0 ) ) ;
177177 }
178178 }
@@ -199,18 +199,20 @@ public class TextPrimitive
199199 public Color Color ;
200200 public WindowTextFont Font ;
201201 public string Text ;
202+ public float DrawRotation ;
202203
203- public TextPrimitive ( Point position , Color color , string text , WindowTextFont font )
204+ public TextPrimitive ( Point position , Color color , string text , WindowTextFont font , float drawRotation = 0 )
204205 {
205206 Position = position ;
206207 Color = color ;
207208 Text = text ;
208209 Font = font ;
210+ DrawRotation = drawRotation ;
209211 }
210212
211213 public void Draw ( SpriteBatch spriteBatch , Point position )
212214 {
213- Font . Draw ( spriteBatch , position , Text , Color ) ;
215+ Font . Draw ( spriteBatch , position , DrawRotation , 0 , Text , LabelAlignment . Left , Color , Color . Black ) ;
214216 }
215217 }
216218 public struct TexturePrimitive
@@ -372,6 +374,7 @@ public class DPITable : DPIWindow
372374 readonly int ColLength = 88 ;
373375 public bool FullTable = true ;
374376 public CABViewControlUnits LoadUnits ;
377+ private float DrawRotation = 0 ;
375378
376379 // Change text color
377380 readonly Dictionary < string , Color > ColorCodeCtrl = new Dictionary < string , Color >
@@ -390,22 +393,24 @@ public class DPITable : DPIWindow
390393
391394 public readonly string [ ] FirstColumn = { "ID" , "Throttle" , "Load" , "BP" , "Flow" , "Remote" , "ER" , "BC" , "MR" } ;
392395
393- public DPITable ( bool fullTable , CABViewControlUnits loadUnits , bool fullScreen , DistributedPowerInterface dpi ) : base ( dpi , 640 , fullTable ? 230 : 162 )
396+ public DPITable ( bool fullTable , CABViewControlUnits loadUnits , bool fullScreen , DistributedPowerInterface dpi , float drawRotation ) : base ( dpi , 640 , fullTable ? 230 : 162 )
394397 {
395398 DPI = dpi ;
396399 FullScreen = fullScreen ;
397400 FullTable = fullTable ;
398401 LoadUnits = loadUnits ;
402+ DrawRotation = drawRotation ;
399403 BackgroundColor = DPI . BlackWhiteTheme ? Color . Black : ColorBackground ;
400404 SetFont ( ) ;
401405 string text = "" ;
402406 for ( int iRow = 0 ; iRow < ( fullTable ? NumberOfRowsFull : NumberOfRowsPartial ) ; iRow ++ )
403407 {
404408 for ( int iCol = 0 ; iCol < NumberOfColumns ; iCol ++ )
405409 {
406- // text = iCol.ToString() + "--" + iRow.ToString();
407- TableText [ iRow , iCol ] = new TextPrimitive ( new Point ( 20 + ColLength * iCol , ( iRow ) * ( FontHeightTableText + 8 ) ) , Color . White , text , TableTextFont ) ;
408- TableSymbol [ iRow , iCol ] = new TextPrimitive ( new Point ( 10 + ColLength * iCol , ( iRow ) * ( FontHeightTableText + 8 ) ) , Color . Green , text , TableSymbolFont ) ;
410+ TableText [ iRow , iCol ] = new TextPrimitive ( new Point ( 20 + ColLength * iCol - ( int ) ( iRow * ( FontHeightTableText - 8 ) * DrawRotation / 2 ) , ( iRow ) * ( FontHeightTableText + 8 ) + ( int ) ( ColLength * iCol * DrawRotation ) ) ,
411+ Color . White , text , TableTextFont , DrawRotation ) ;
412+ TableSymbol [ iRow , iCol ] = new TextPrimitive ( new Point ( 10 + ColLength * iCol - ( int ) ( iRow * ( FontHeightTableText - 8 ) * DrawRotation / 2 ) , ( iRow ) * ( FontHeightTableText + 8 ) + ( int ) ( ColLength * iCol * DrawRotation ) ) ,
413+ Color . Green , text , TableSymbolFont , DrawRotation ) ;
409414 }
410415 }
411416 }
0 commit comments