Load() public static method

public static Load ( string name ) : Texture2D
name string
return Texture2D
Ejemplo n.º 1
0
        private static void Run(object context)
        {
            bool looping = true;

            Main.instance.add_Exiting((EventHandler <EventArgs>)((obj, args) =>
            {
                looping = false;
                if (!Monitor.TryEnter(TextureManager._loadThreadLock))
                {
                    return;
                }
                Monitor.Pulse(TextureManager._loadThreadLock);
                Monitor.Exit(TextureManager._loadThreadLock);
            }));
            Monitor.Enter(TextureManager._loadThreadLock);
            while (looping)
            {
                if (TextureManager._loadQueue.Count != 0)
                {
                    TextureManager.LoadPair result;
                    if (TextureManager._loadQueue.TryDequeue(out result))
                    {
                        result.TextureRef.Value = TextureManager.Load(result.Path);
                    }
                }
                else
                {
                    Monitor.Wait(TextureManager._loadThreadLock);
                }
            }
            Monitor.Exit(TextureManager._loadThreadLock);
        }
Ejemplo n.º 2
0
 public static Ref <Texture2D> AsyncLoad(string name)
 {
     return(new Ref <Texture2D>(TextureManager.Load(name)));
 }