Example #1
0
        public FrmMain()
        {
            var map             = "europe.ets2";
            var universalFolder = Directory.Exists(@"E:\map\" + map + "\\")
                ? @"E:\map\" + map + "\\"
                : Directory.Exists(@"E:\Games\Steam\steamapps\common\Euro Truck Simulator 2\base\map")
                    ? @"E:\Games\Steam\steamapps\common\Euro Truck Simulator 2\base\map\" + map + "\\"
                    : @"./europe/";

            var prefabs = @"E:\Mods\ETS2\data 1.19\base\prefab\";

            Ets2Map = new Ets2Mapper(universalFolder, prefabs, @"C:\Projects\Software\SimShift\Resources\LUT1.19");
            Ets2Map.Parse();
            Main.SetMap(Ets2Map);

            //SimulationEnvironment sim = new SimulationEnvironment();
            InitializeComponent();

            this.StartPosition = FormStartPosition.Manual;
            this.Location      = new Point(0, 0);

            btServiceStartStop_Click(null, null);

            gbCarSelect.Enabled = false;

            updateModules          = new Timer();
            updateModules.Interval = 25;
            updateModules.Tick    += updateModules_Tick;
            updateModules.Start();
        }
Example #2
0
        public FrmMain()
        {
            var map             = "europe";
            var universalFolder = @"..\..\..\..\..\base\map\" + map + "\\";
            var prefabs         = @"..\..\..\..\..\base\prefab\";
            var lutFolder       = @"..\..\\Resources\LUT1.19";

            Ets2Map = new Ets2Mapper(universalFolder, prefabs, lutFolder);

            Ets2Map.Parse();
            Main.SetMap(Ets2Map);

            //SimulationEnvironment sim = new SimulationEnvironment();
            InitializeComponent();

            this.StartPosition = FormStartPosition.Manual;
            this.Location      = new Point(0, 0);

            btServiceStartStop_Click(null, null);

            gbCarSelect.Enabled = false;

            updateModules          = new Timer();
            updateModules.Interval = 25;
            updateModules.Tick    += updateModules_Tick;
            updateModules.Start();
        }
Example #3
0
        public Ets2MapDemo()
        {
            var projectMap = @"C:\Projects\Software\ets2-map\";

            map = new Ets2Mapper(
                projectMap + @"SCS\europe\",
                projectMap + @"SCS\prefab",
                projectMap + @"SCS\LUT1.19",
                projectMap + @"LUT\LUT1.19");
            map.Parse(true);

            render = new MapRenderer(map, new SimpleMapPalette());

            InitializeComponent();

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            refresh = new Timer();
            refresh.Interval = 250;
            refresh.Tick += (sender, args) => Invalidate();
            refresh.Start();

            // Panning around
            MouseDown += (s, e) => dragPoint = e.Location;
            MouseUp += (s, e) => dragPoint = null;
            MouseMove += (s, e) =>
            {
                if (dragPoint.HasValue)
                {
                    var spd = mapScale/Math.Max(this.Width, this.Height);
                    location = new Ets2Point(location.X - (e.X - dragPoint.Value.X)*spd,
                        0,
                        location.Z - (e.Y - dragPoint.Value.Y)*spd,
                        0);
                    dragPoint = e.Location;
                }
            };

            // Zooming in
            MouseWheel += Ets2MapDemo_MouseWheel;

            // Navigation
            MouseDoubleClick += Ets2MapDemo_MouseDoubleClick;

            Resize += Ets2MapDemo_Resize;
        }
Example #4
0
        public Ets2MapDemo()
        {
            // Set location based on game
            switch (Game)
            {
            case GAME.ETS2:
                location = new Ets2Point(0, 0, 0, 0);
                break;

            case GAME.ATS:
                location = new Ets2Point(-100000, 0, 17000, 0);
                break;
            }

            // Get current folder and remove "\Ets2Map\Ets2Map.Demo\bin\[Debug|Release]"
            var projectFolder = Directory.GetCurrentDirectory();

            for (int i = 0; i < 4; i++)
            {
                projectFolder = projectFolder.Substring(0, projectFolder.LastIndexOf("\\"));
            }

            // Load game specific folder
            var mapFilesFolder = projectFolder + "\\" + (Game == GAME.ETS2 ? "europe" : "usa");

            map = new Ets2Mapper(
                mapFilesFolder + @"\SCS\map\",
                mapFilesFolder + @"\SCS\prefab\",
                mapFilesFolder + @"\SCS\LUT\",
                mapFilesFolder + @"\LUT\");
            map.Parse(true);

            render = new MapRenderer(map, new SimpleMapPalette());

            InitializeComponent();

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            refresh          = new Timer();
            refresh.Interval = 250;
            refresh.Tick    += (sender, args) => Invalidate();
            refresh.Start();

            // Panning around
            MouseDown += (s, e) => dragPoint = e.Location;
            MouseUp   += (s, e) => dragPoint = null;
            MouseMove += (s, e) => {
                if (dragPoint.HasValue)
                {
                    var spd = mapScale / Math.Max(this.Width, this.Height);
                    location = new Ets2Point(location.X - (e.X - dragPoint.Value.X) * spd,
                                             0,
                                             location.Z - (e.Y - dragPoint.Value.Y) * spd,
                                             0);
                    dragPoint = e.Location;
                }
            };

            // Zooming in
            MouseWheel += Ets2MapDemo_MouseWheel;

            // Navigation
            MouseDoubleClick += Ets2MapDemo_MouseDoubleClick;

            Resize += Ets2MapDemo_Resize;
        }