@@ -82,7 +82,7 @@ public class DistributedPowerInterface
82
82
/// </summary>
83
83
public bool IsSoftLayout ;
84
84
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 )
86
86
{
87
87
Viewer = viewer ;
88
88
Locomotive = locomotive ;
@@ -172,7 +172,7 @@ public DPDefaultWindow(DistributedPowerInterface dpi, CabViewControl control) :
172
172
sUnits = sUnits . Replace ( '/' , '_' ) ;
173
173
CABViewControlUnits . TryParse ( sUnits , out LoadUnits ) ;
174
174
}
175
- DPITable = new DPITable ( FullTable , LoadUnits , fullScreen : true , dpi : dpi ) ;
175
+ DPITable = new DPITable ( FullTable , LoadUnits , fullScreen : true , dpi : dpi , ( control as CVCScreen ) . Rotation ) ;
176
176
AddToLayout ( DPITable , new Point ( 0 , 0 ) ) ;
177
177
}
178
178
}
@@ -199,18 +199,20 @@ public class TextPrimitive
199
199
public Color Color ;
200
200
public WindowTextFont Font ;
201
201
public string Text ;
202
+ public float DrawRotation ;
202
203
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 )
204
205
{
205
206
Position = position ;
206
207
Color = color ;
207
208
Text = text ;
208
209
Font = font ;
210
+ DrawRotation = drawRotation ;
209
211
}
210
212
211
213
public void Draw ( SpriteBatch spriteBatch , Point position )
212
214
{
213
- Font . Draw ( spriteBatch , position , Text , Color ) ;
215
+ Font . Draw ( spriteBatch , position , DrawRotation , 0 , Text , LabelAlignment . Left , Color , Color . Black ) ;
214
216
}
215
217
}
216
218
public struct TexturePrimitive
@@ -372,6 +374,7 @@ public class DPITable : DPIWindow
372
374
readonly int ColLength = 88 ;
373
375
public bool FullTable = true ;
374
376
public CABViewControlUnits LoadUnits ;
377
+ private float DrawRotation = 0 ;
375
378
376
379
// Change text color
377
380
readonly Dictionary < string , Color > ColorCodeCtrl = new Dictionary < string , Color >
@@ -390,22 +393,24 @@ public class DPITable : DPIWindow
390
393
391
394
public readonly string [ ] FirstColumn = { "ID" , "Throttle" , "Load" , "BP" , "Flow" , "Remote" , "ER" , "BC" , "MR" } ;
392
395
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 )
394
397
{
395
398
DPI = dpi ;
396
399
FullScreen = fullScreen ;
397
400
FullTable = fullTable ;
398
401
LoadUnits = loadUnits ;
402
+ DrawRotation = drawRotation ;
399
403
BackgroundColor = DPI . BlackWhiteTheme ? Color . Black : ColorBackground ;
400
404
SetFont ( ) ;
401
405
string text = "" ;
402
406
for ( int iRow = 0 ; iRow < ( fullTable ? NumberOfRowsFull : NumberOfRowsPartial ) ; iRow ++ )
403
407
{
404
408
for ( int iCol = 0 ; iCol < NumberOfColumns ; iCol ++ )
405
409
{
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 ) ;
409
414
}
410
415
}
411
416
}
0 commit comments