Пример #1
0
 /// <summary>
 /// Adds an existing <see cref="SpriteFont"/> object.
 /// </summary>
 /// <param name="id"><see cref="FontIDs"/> id being associated with the <see cref="SpriteFont"/> object.</param>
 /// <param name="texture">A <see cref="SpriteFont"/> object.</param>
 public static void AddFont(FontIDs id, SpriteFont font)
 {
     if (fonts.ContainsKey(id))
     {
         fonts[id] = font;
     }
     else
     {
         fonts.Add(id, font);
     }
 }
Пример #2
0
 /// <summary>
 /// This will add a font path to the dictionary under the provided <see cref="FontIDs"/> ID.
 /// </summary>
 /// <param name="id"><see cref="FontIDs"/> to associate font with the <see cref="SpriteFont"/>.</param>
 /// <param name="path">Path to the <see cref="SpriteFont"/> object.</param>
 /// <param name="ids">List of <see cref="FontIDs"/> that resources have been added for.</param>
 /// <param name="paths">List of <see cref="string"/> paths to <see cref="SpriteFont"/> objects.</param>
 private void LoadFont(FontIDs id, string path, List <FontIDs> ids, Dictionary <FontIDs, string> paths)
 {
     ids.Add(id);
     paths.Add(id, path);
 }
Пример #3
0
        /// <summary>
        /// Adds a new <see cref="SpriteFont"/> through the <see cref="ContentManager"/> pipeline.
        /// </summary>
        /// <param name="id"><see cref="FontIDs"/> id being associated with the <see cref="SpriteFont"/> object.</param>
        /// <param name="path">A <see cref="string"/> path to the <see cref="SpriteFont"/> object.</param>
        public static void AddFont(FontIDs id, string path)
        {
            SpriteFont font = Content.Load <SpriteFont>(path);

            AddFont(id, font);
        }