Example #1
0
        public Task <Texture2D> LoadTextureAsync(string uri)
        {
            return(Task.Run(async() =>
            {
                LoadTextureProgress progress = new LoadTextureProgress(2137);
                Console.WriteLine("Status: " + progress.Status);
                int textureId = InvokeCanvasMethodUnmarshalled <int>(UnmarshalledCanvasMethod.LoadTexture, uri, progress);

                while (progress.Status != 1)
                {
                    await Task.Delay(10);
                }

                Console.WriteLine("Status: " + progress.Status);

                Console.WriteLine("Loaded");
                Texture2D texture = new Texture2D(this, textureId, progress.Width, progress.Height);

                return texture;
            }));
        }
Example #2
0
 internal static void SetProgress(LoadTextureProgress progress, int width, int height)
 {
     progress.Status = 1;
     progress.Width  = width;
     progress.Height = height;
 }