generateAtlases() публичный Метод

public generateAtlases ( string outputPath, int maxWidth, int maxHeight, bool genJSON, bool genRBXLua ) : void
outputPath string
maxWidth int
maxHeight int
genJSON bool
genRBXLua bool
Результат void
Пример #1
0
        private void generateButton_Click(object sender, EventArgs e)
        {
            int count = 0;

            int w = 0, h = 0;

            int.TryParse(widthBox.Text, out w);
            int.TryParse(heightBox.Text, out h);

            string characters = characterBox.Text;

            if (characters.Length == 0)
            {
                for (int i = 32; i <= 126; i++)
                {
                    characters += (char)i;
                }
            }

            string outputPath = string.Empty;

            if (System.IO.Directory.Exists(outputSelection.SelectedPath))
            {
                outputPath = outputSelection.SelectedPath;
            }
            else
            {
                outputPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            }

            if (fileNames != null)
            {
                Dictionary <string, List <Face> > families = new Dictionary <string, List <Face> >();
                foreach (string path in fileNames)
                {
                    Face face = new Face(library, path);
                    if (families.ContainsKey(face.FamilyName))
                    {
                        families[face.FamilyName].Add(face);
                    }
                    else
                    {
                        families[face.FamilyName] = new List <Face> {
                            face
                        };
                    }
                }

                // generate
                foreach (KeyValuePair <string, List <Face> > kvp in families)
                {
                    SpriteSheet sprites = new SpriteSheet(kvp.Value.ToArray(), characters, sizes, kvp.Key);
                    sprites.generateAtlases(outputPath, w, h, JSONCheckBox.Checked, RBXLuaCheckBox.Checked);
                    count++;
                }

                outputMessage.Text = "Generated " + count + " font" + (count == 1 ? "" : "s") + "!";
            }
        }
Пример #2
0
        private void generateButton_Click(object sender, EventArgs e)
        {
            int count = 0;

            int w = 0, h = 0;
            int.TryParse(widthBox.Text, out w);
            int.TryParse(heightBox.Text, out h);

            string characters = characterBox.Text;
            if (characters.Length == 0)
            {
                for (int i = 32; i <= 126; i++)
                {
                    characters += (char)i;
                }
            }

            string outputPath = string.Empty;
            if (System.IO.Directory.Exists(outputSelection.SelectedPath))
            {
                outputPath = outputSelection.SelectedPath;
            }
            else
            {
                outputPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            }

            if (fileNames != null)
            {
                Dictionary<string, List<Face>> families = new Dictionary<string, List<Face>>();
                foreach (string path in fileNames)
                {
                    Face face = new Face(library, path);
                    if (families.ContainsKey(face.FamilyName))
                    {
                        families[face.FamilyName].Add(face);
                    }
                    else
                    {
                        families[face.FamilyName] = new List<Face> { face };
                    }
                }

                // generate
                foreach (KeyValuePair<string, List<Face>> kvp in families)
                {
                    SpriteSheet sprites = new SpriteSheet(kvp.Value.ToArray(), characters, sizes, kvp.Key);
                    sprites.generateAtlases(outputPath, w, h, JSONCheckBox.Checked, RBXLuaCheckBox.Checked);
                    count++;
                }

                outputMessage.Text = "Generated " + count + " font" + (count == 1 ? "" : "s") + "!";
            }
        }