Пример #1
0
        /// <summary>
        /// You can create a Texture to wrap your own texture handle (i.e. a rendertarget)
        /// This texture will not own the handle; when it's unloaded, the handle will remain untouched.
        /// </summary>
        public static Texture CreateFromTextureHandle(ContentManager manager, ImageInfo info, IntPtr handle)
        {
            var textureLoader = new ContentLoaderProxy(
                (ContentLoadContext context) =>
            {
                var texture     = context.Content as Texture;
                texture.mHandle = handle;
                texture.info    = info;
                return(true);
            }
                );

            return(manager.CreateWith <Texture>(textureLoader));
        }
Пример #2
0
        // <summary>
        // Creates a solid colored Art resource with these characteristics
        // </summary>
        public static Art CreateSolidColor(ContentManager manager, int width, int height, uint color)
        {
            var textureLoader = new ContentLoaderProxy(
                (ContentLoadContext context) =>
            {
                var texture = context.Content as Texture;
                ((PrivateInterfaces.ITextureLoaders)texture).LoadSolidColor(width, height, color);
                return(true);
            }
                );

            var artLoader = new ContentLoaderProxy(
                (ContentLoadContext context) =>
            {
                var art     = context.Content as Art;
                art.mWidth  = width;
                art.mHeight = height;
                manager.LoadWith(art.Texture, textureLoader);
                return(true);
            }
                );

            return(manager.CreateWith <Art>(artLoader));
        }