Exemplo n.º 1
0
 public FormEditor()
 {
     Console.WriteLine("build");
     InitializeComponent();
     renderer = new IsometricRenderer();
     result   = null;
     renderTimer.Start();
     Repainting = true;
 }
Exemplo n.º 2
0
        public FormEditor()
        {
            Console.WriteLine("Start");
            InitializeComponent();
            directory = directorySave = directoryImport = directoryExport = "";

            if (File.Exists("config.ini"))
            {
                string[] configLines = File.ReadAllLines("config.ini");
                var      config      = new SortedList <string, string>();
                for (int i = 0; i < configLines.Length; i++)
                {
                    string[] pair = configLines[i].Split(' ');
                    for (int j = 0; j < pair.Length - 2; j++)
                    {
                        pair[1] += " " + pair[j + 2];
                    }
                    if (pair.Length >= 2)
                    {
                        config.Add(pair[0].Trim().ToLower(), pair[1].Trim());
                    }
                }
                try
                {
                    if (config.TryGetValue("-fullscreen", out string fullscreen))
                    {
                        Fullscreen(Convert.ToBoolean(fullscreen));
                    }
                    if (config.TryGetValue("-width", out string width))
                    {
                        Width = Convert.ToInt32(width);
                    }
                    if (config.TryGetValue("-height", out string height))
                    {
                        Height = Convert.ToInt32(height);
                    }
                    if (config.TryGetValue("-directory", out string path))
                    {
                        directory = directorySave = directoryImport = directoryExport = path.Trim('"');
                    }
                    if (config.TryGetValue("-directorysave", out string paths))
                    {
                        directorySave = paths.Trim('"');
                    }
                    if (config.TryGetValue("-directoryexport", out string pathe))
                    {
                        directoryExport = pathe.Trim('"');
                    }
                    if (config.TryGetValue("-directoryimport", out string pathi))
                    {
                        directoryImport = pathi.Trim('"');
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("config error " + e.Message);
                }
            }
            else
            {
                Console.WriteLine("config not found");
            }

            renderer = new IsometricRenderer();
            renderer.LoadDataFromBitmapFile(directoryImport + "/Mountain_512.png");
            renderer.TexturePack.Load(directory + "/default.tex");
            Console.WriteLine("Init Renderer");
            result = null;
            renderTimer.Start();
            Repainting = true;
        }