Exemple #1
0
        public BmLabel(BmFontFile file, Shader shader, IStore <Texture> textureStore)
        {
            this.file   = file;
            this.shader = shader;

            fontSize = file.fontSize;

            textures = new Texture[file.pages];
            for (int i = 0; i < file.pages; i += 1)
            {
                textures[i] = textureStore.Get(file.pageNames[i]);
            }
        }
Exemple #2
0
        /// <summary>
        /// Initialize the WorldTextRenderer
        /// across any possible instances
        /// </summary>
        /// <param name="graphics"></param>
        public static void Init(DeviceContext graphics)
        {
            // Do nothing if both are initialized
            if (WorldTextRenderer.FontTexture != null && !WorldTextRenderer.FontTexture.IsDisposed)
            {
                return;
            }

            if (WorldTextRenderer.FontTexture != null && WorldTextRenderer.FontTexture.IsDisposed)
            {
                WorldTextRenderer.CharacterMap.Clear();
            }

            WorldTextRenderer.FontFile    = BmFontLoader.Load(GameContext.ContentLoader.RootDirectory + "/mods/Sunbeam/Font/helvetipixel.fnt");
            WorldTextRenderer.FontTexture = graphics.GetTexture("mods/Sunbeam/Font/helvetipixel_0");

            foreach (BmFontChar fChar in WorldTextRenderer.FontFile.Chars)
            {
                char c = (char)fChar.ID;
                WorldTextRenderer.CharacterMap.Add(c, fChar);
            }
        }