Beispiel #1
0
        public T Load <T>(GraphicsDevice graphicsDevice, string path)
        {
            int uniqueKey = path.GetHashCode() + typeof(T).GetHashCode();

            IContentLoader contentReader;

            if (resourceList.ContainsKey(uniqueKey))
            {
                return((T)resourceList[uniqueKey]);
            }
            else
            {
                if (typeof(T) == typeof(LeaTexture2D))
                {
                    contentReader = new BitMapLoader();
                    var image = contentReader.Load(path) as Image;

                    var tex = LeaTexture2D.Create(graphicsDevice, image);

                    resourceList.Add(uniqueKey, tex);
                }

                if (typeof(T) == typeof(LeaEffect))
                {
                }


                return((T)resourceList[uniqueKey]);
            }
        }
Beispiel #2
0
        public static IContentLoader GetContentLoader(Type type)
        {
            IContentLoader contentLoader = null;

            if (type == typeof(LeaTexture2D))
            {
                contentLoader = new BitMapLoader();
            }
            else
            {
                throw new Exception("NOT SUPPORTET");
            }

            return(contentLoader);
        }