예제 #1
0
        public Dashboard(DrivableVehicle car, DashboardDescription descriptor)
        {
            _car        = car;
            _descriptor = descriptor;
            _car.Motor.Gearbox.GearChangeStarted += new EventHandler(Gearbox_GearChangeStarted);

            _gearBoxAnimation = new GearboxAnimation();

            //_instrumentLine = Engine.Instance.ContentManager.Load<Texture2D>("Content\\SpeedoLine");
            if (_tachLineTexture == null)
            {
                _tachLineTexture = new Texture2D(Engine.Instance.Device, (int)3, 25);
                Color[] pixels = new Color[_tachLineTexture.Width * _tachLineTexture.Height];
                for (int i = 0; i < pixels.Length; i++)
                {
                    pixels[i] = Color.Red;
                }
                _tachLineTexture.SetData <Color>(pixels);
            }

            FshFile fsh     = new FshFile(Path.Combine(@"SIMDATA\DASH", descriptor.Filename));
            var     bitmaps = fsh.Header;

            Dash     = bitmaps.FindByName("dash");
            GearGate = bitmaps.FindByName("gate");
            GearKnob = bitmaps.FindByName("nob1");

            Leather1 = bitmaps.FindByName("lth1");
            Leather2 = bitmaps.FindByName("lth2");
            Leather3 = bitmaps.FindByName("lth3");

            //steering wheel images, from straight to left, then to the right.  Not all cars have all steering angles
            Wstr = bitmaps.FindByName("wstr");
            Wl06 = bitmaps.FindByName("wl06");
            Wl14 = bitmaps.FindByName("wl14");
            Wl22 = bitmaps.FindByName("wl22");
            Wl32 = bitmaps.FindByName("wl32");
            if (Wl32 == null)
            {
                Wl32 = Wl22;
            }
            Wl45 = bitmaps.FindByName("wl45");
            if (Wl45 == null)
            {
                Wl45 = Wl32;
            }
            Wr06 = bitmaps.FindByName("wr06");
            Wr14 = bitmaps.FindByName("wr14");
            Wr22 = bitmaps.FindByName("wr22");
            Wr32 = bitmaps.FindByName("wr32");
            if (Wr32 == null)
            {
                Wr32 = Wr22;
            }
            Wr45 = bitmaps.FindByName("wr45");
            if (Wr45 == null)
            {
                Wr45 = Wr32;
            }
        }
예제 #2
0
        public BaseExternalView()
        {
            if (_bottomBar == null)
            {
                var fsh = new FshFile(@"Simdata\Misc\MaskHi.fsh");
                _bottomBar  = fsh.Header.Bitmaps.Find(a => a.Id == "b00b");
                _bottomFill = fsh.Header.Bitmaps.Find(a => a.Id == "0002");
                _tacho      = fsh.Header.Bitmaps.Find(a => a.Id == "tach");
                _map        = fsh.Header.Bitmaps.Find(a => a.Id == "mpbd");

                _tachLineTexture = new Texture2D(Engine.Instance.Device, (int)_needleWidth, 25);
                Color[] pixels = new Color[_tachLineTexture.Width * _tachLineTexture.Height];
                for (int i = 0; i < pixels.Length; i++)
                {
                    pixels[i] = Color.Red;
                }
                _tachLineTexture.SetData <Color>(pixels);
            }
        }