Ejemplo n.º 1
0
        /// <summary>Attempts to find and apply an image to the given character.</summary>
        /// <param name="character">The on screen character to attempt to find an image for.</param>
        public static void FindInto(Glyph loadInto, int charcode)
        {
            CharacterProvider provider = FindFor(charcode);

            if (provider == null)
            {
                return;
            }

            // The provider is likely able to supply us with the character.
            // If it does then we simply return it.

            // Load into the glyph now:
            provider.Load(loadInto, charcode);
        }
        /// <summary>Attempts to find and apply an image to the given character.</summary>
        /// <param name="character">The on screen character to attempt to find an image for.</param>
        public static Glyph Find(int charcode)
        {
            CharacterProvider provider = FindFor(charcode);

            if (provider == null)
            {
                return(null);
            }

            // The provider is likely able to supply us with the character.
            // If it can't, we can just assume nobody else can.
            Glyph glyph = new Glyph();

            // Update the charcode:
            glyph.RawCharcode = charcode;

            // Load into the glyph now:
            provider.Load(glyph, charcode);

            return(glyph);
        }
Ejemplo n.º 3
0
        /// <summary>Attempts to find and apply an image to the given character.</summary>
        /// <param name="character">The on screen character to attempt to find an image for.</param>
        public static Glyph Find(int charcode)
        {
            Glyph glyph;

            if (CachedCharacters != null && CachedCharacters.TryGetValue(charcode, out glyph))
            {
                return(glyph);
            }

            CharacterProvider provider = FindFor(charcode);

            if (provider == null)
            {
                return(null);
            }

            // The provider is likely able to supply us with the character.
            // If it can't, we can just assume nobody else can.
            glyph = new Glyph();

            // Update the charcode:
            glyph.RawCharcode = charcode;

            // Load into the glyph now:
            provider.Load(glyph, charcode);

            // Cache it next:
            if (CachedCharacters == null)
            {
                CachedCharacters = new Dictionary <int, Glyph>();
            }

            CachedCharacters[charcode] = glyph;

            return(glyph);
        }