public DriverMachineInterface(float height, float width, MSTSLocomotive locomotive, Viewer viewer, CabViewControl control) { if (control is CVCScreen) { CurrentDMIMode = DMIMode.FullSize; if ((control as CVCScreen).CustomParameters.TryGetValue("mode", out string mode)) { if (mode == "planningarea") { CurrentDMIMode = DMIMode.PlanningArea; } else if (mode == "speedarea") { CurrentDMIMode = DMIMode.SpeedArea; } } } else { CurrentDMIMode = DMIMode.GaugeOnly; } switch (CurrentDMIMode) { case DMIMode.GaugeOnly: Width = 280; Height = 300; break; case DMIMode.FullSize: Width = 640; Height = 480; break; case DMIMode.PlanningArea: case DMIMode.SpeedArea: Width = 334; Height = 480; break; } Viewer = viewer; Locomotive = locomotive; Scale = Math.Min(width / Width, height / Height); if (Scale < 0.5) { MipMapScale = 2; } else { MipMapScale = 1; } Shader = new DriverMachineInterfaceShader(Viewer.GraphicsDevice); ETCSDefaultWindow = new ETCSDefaultWindow(this, control); ETCSDefaultWindow.Visible = true; AddToLayout(ETCSDefaultWindow, Point.Zero); ActiveWindow = ETCSDefaultWindow; }
public CircularSpeedGauge(int width, int height, int maxSpeed, bool unitMetric, bool unitVisible, bool dialQuarterLines, int maxVisibleScale, MSTSLocomotive locomotive, Viewer viewer, CabShader shader) { UnitVisible = unitVisible; SetUnit(unitMetric); DialQuarterLines = dialQuarterLines; MaxSpeed = maxSpeed; MaxVisibleScale = maxVisibleScale; Viewer = viewer; Locomotive = locomotive; cabShader = shader; SizeTo(width, height); SetRange(MaxSpeed); CurrentSpeed = new TextPrimitive[3]; for (var i = 0; i < CurrentSpeed.Length; i++) { CurrentSpeed[i] = new TextPrimitive(new Point(CurrentSpeedPosition[i], CurrentSpeedPosition[3]), Color.Black, "0", FontCurrentSpeed); } ReleaseSpeed = new TextPrimitive(ReleaseSpeedPosition, ColorGrey, String.Empty, FontReleaseSpeed); Shader = new DriverMachineInterfaceShader(Viewer.RenderProcess.GraphicsDevice); if (NeedleTextureData == null) { NeedleTextureData = new Color[128 * 16]; // Needle texture is according to ETCS specification for (var v = 0; v < 128; v++) { for (var u = 0; u < 16; u++) { NeedleTextureData[u + 16 * v] = ( v <= 15 && 5 < u && u < 9 || 15 < v && v <= 23 && 5f - (float)(v - 15) / 8f * 3f < u && u < 9f + (float)(v - 15) / 8f * 3f || 23 < v && v < 82 && 2 < u && u < 12 ) ? Color.White : Color.Transparent; } } } }
public DistributedPowerInterface(float height, float width, MSTSLocomotive locomotive, Viewer viewer, CabViewControl control) { Viewer = viewer; Locomotive = locomotive; Scale = Math.Min(width / Width, height / Height); if (Scale < 0.5) { MipMapScale = 2; } else { MipMapScale = 1; } Shader = new DriverMachineInterfaceShader(Viewer.GraphicsDevice); DPDefaultWindow = new DPDefaultWindow(this, control); DPDefaultWindow.Visible = true; AddToLayout(DPDefaultWindow, Point.Zero); ActiveWindow = DPDefaultWindow; }
public DriverMachineInterface(float height, float width, MSTSLocomotive locomotive, Viewer viewer, CabViewControl control) { Viewer = viewer; Locomotive = locomotive; Scale = Math.Min(width / Width, height / Height); if (Scale < 0.5) { MipMapScale = 2; } else { MipMapScale = 1; } GaugeOnly = control is CVCDigital; Shader = new DriverMachineInterfaceShader(Viewer.GraphicsDevice); ETCSDefaultWindow = new ETCSDefaultWindow(this, control); ETCSDefaultWindow.Visible = true; AddToLayout(ETCSDefaultWindow, Point.Zero); ActiveWindow = ETCSDefaultWindow; }