Пример #1
0
 public LTexture(string @resName)
 {
     this.ext = FileUtils.GetExtension(resName);
     if ("".Equals(ext) || "xna".Equals(ext, StringComparison.InvariantCultureIgnoreCase))
     {
         this.isExt = false;
     }
     else
     {
         this.isExt = true;
     }
     if (isExt)
     {
         BitmapDecoder image = new BitmapDecoder(resName);
         this.width  = image.GetWidth();
         this.height = image.GetHeight();
     }
     else
     {
         if (LSystem.screenProcess != null)
         {
             Screen screen = LSystem.screenProcess.GetScreen();
             if (screen != null && screen.IsOnLoadComplete())
             {
                 tex2d  = LFXPlus.Get.Load <Texture2D>(StringUtils.ReplaceIgnoreCase(resName, ".xnb", ""));
                 width  = tex2d.Width;
                 height = tex2d.Height;
             }
         }
     }
     this.texWidth  = width;
     this.texHeight = height;
     this.fileName  = resName;
     if (isExt)
     {
         this.ins = Resource.Resources.OpenStream(resName);
     }
     NextID();
 }