Exemplo n.º 1
0
        /// <summary>
        /// Load a texture by it's name
        /// </summary>
        /// <param name="name">Name the texture</param>
        /// <param name="skipCheck">Skip file exists check</param>
        public async Task LoadAsync(string name, bool skipCheck = false)
        {
            if (Images.ContainsKey(name))
            {
                return;
            }

            var file = _imageDirectory.File(name + ".png");

            if (!skipCheck && !file.Exists)
            {
                return;
            }

            var data = await file.ReadFileDataAsync();

            var tex = CommonExtensions.CreateTexture(data, name);

            Images.Add(name, tex);
        }