Example #1
0
        /// <summary>
        /// Loads a texture into memory from specified path
        /// using Loader.AutoTexture(name) and added to Atlas
        /// under specified name.
        ///
        /// Will throw error if true and the specified
        /// name is already occupied.
        /// </summary>
        public void LoadAnonymous(string path, string name, bool throwException = true)
        {
            name = name.ToLower();

            if (_textures.ContainsKey(name))
            {
                if (!throwException)
                {
                    return;
                }
                throw new InvalidOperationException("Key already exists with that name!");
            }

            _textures.Add(name, Loader.AutoTexture(path));
        }