Esempio n. 1
0
        internal static void Initialize()
        {
            NVG.InitOpenGL();
            Engine.NVGCtx = NVG.CreateGL3(NVG.NVG_DEBUG | NVG.NVG_ANTIALIAS);

            string[]      Fonts       = ContentManager.GetAllFonts();
            List <string> LoadedFonts = new List <string>();

            foreach (var Font in Fonts)
            {
                string FontName = Files.GetFileName(Font);
                NVG.CreateFont(Engine.NVGCtx, FontName, Font);
                LoadedFonts.Add(FontName);
            }

            // Every font is the fallback for every other font. TODO: Is this even a good idea?
            for (int i = 0; i < LoadedFonts.Count; i++)
            {
                for (int j = 0; j < LoadedFonts.Count; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }

                    NVG.AddFallbackFont(Engine.NVGCtx, LoadedFonts[i], LoadedFonts[j]);
                }
            }

            NVG.ImagePattern(Engine.NVGCtx, 0, 0, 100, 100, 0, 0, 0);
        }