Ejemplo n.º 1
0
        public Texture2D LoadAndCacheTexture(int index, GraphicsDevice device, string basepath)
        {
            if (TexturesCache.ContainsKey(index) == false)
            {
                var dataFilepath = TexturesPaths[index];
                var filepath     = Path.Combine(basepath, dataFilepath);
                TexturesCache[index] = ImageExtensions.FromFile(filepath, device);
            }

            return(TexturesCache[index]);
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public formRaildriverCalibration()
 {
     InitializeComponent();
     main = (Bitmap)ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\raildriver.png"));
     pictureBox1.Image = main;
     buttonCalibrationPrevious.Enabled = false;
     labelCalibrationText.Text         = Translations.GetInterfaceString("raildriver_calibration_start");
     if (Program.Joysticks.RailDriverCount == 0)
     {
         MessageBox.Show(Translations.GetInterfaceString("raildriver_notdetected"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Load += (s, e) => Close();
         return;
     }
     buttonCalibrationNext.Text     = Translations.GetInterfaceString("packages_button_next");
     buttonCalibrationPrevious.Text = Translations.GetInterfaceString("packages_button_back");
 }
Ejemplo n.º 3
0
        private void paintImage()
        {
            switch (calibrationStage)
            {
            case 0:
                pictureBox1.Image         = main;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_start");
                break;

            case 1:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(210, 130, 80, 145));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_down.png")), 234, 284);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_a");
                break;

            case 2:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(210, 130, 80, 145));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_up.png")), 234, 84);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_b");
                break;

            case 3:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(290, 130, 90, 145));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_down.png")), 314, 284);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_c");
                break;

            case 4:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(290, 130, 90, 145));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_up.png")), 314, 84);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_d");
                break;

            case 5:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(450, 130, 80, 165));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_down.png")), 470, 304);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_e");
                break;

            case 6:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(450, 130, 80, 165));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_up.png")), 470, 79);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_f");
                break;

            case 7:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(610, 130, 75, 165));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_down.png")), 630, 304);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_g");
                break;

            case 8:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(610, 130, 75, 165));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_up.png")), 630, 79);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_h");
                break;

            case 9:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(610, 130, 75, 165));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_left.png")), 560, 175);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_i");
                break;

            case 10:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(610, 130, 75, 165));
                    graphics.DrawImage(ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\arrow_right.png")), 690, 175);
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_j");
                break;

            case 11:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(715, 100, 55, 75));
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_k");
                break;

            case 12:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(715, 100, 55, 75));
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_l");
                break;

            case 13:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(715, 210, 55, 75));
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_m");
                break;

            case 14:
                Modified = new Bitmap(main);
                using (var graphics = Graphics.FromImage(Modified))
                {
                    graphics.DrawRectangle(new Pen(Color.Blue, 3.0f), new Rectangle(715, 210, 55, 75));
                }
                pictureBox1.Image         = Modified;
                labelCalibrationText.Text = Translations.GetInterfaceString("raildriver_calibration_n");
                break;

            case 15:
                pictureBox1.Image          = main;
                labelCalibrationText.Text  = Translations.GetInterfaceString("raildriver_calibration_o");
                buttonCalibrationNext.Text = Translations.GetInterfaceString("packages_success");
                break;
            }
        }
Ejemplo n.º 4
0
        public void Load(GraphicsDevice device, string basepath)
        {
            var filepath = string.Format("{0}/data/texture/{1}", basepath, Filename);

            Texture = ImageExtensions.FromFile(filepath, device);
        }