예제 #1
0
        public EmulatorButton(LTexture img, int w, int h, int x, int y,
                bool flag, int sizew, int sizeh)
        {
            this.color = new LColor(LColor.gray.R, LColor.gray.G,
                            LColor.gray.B, 125);
            img.LoadTexture();
            if (flag)
               {
                this.bitmap = img.GetSubTexture(x, y, w, h);
            }
            else
            {
                this.bitmap = img;
            }
            if (bitmap.GetWidth() != sizew || bitmap.GetHeight() != sizeh)
            {

                LTexture tmp = bitmap;
                this.bitmap = bitmap.Scale(sizew, sizeh);

                if (tmp != null)
                {
                    tmp.Dispose();
                    tmp = null;
                }
            }
            this.bounds = new RectBox(0, 0, bitmap.GetWidth(), bitmap.GetHeight());
        }
예제 #2
0
        public static LTexture[][] GetSplit2Textures(LTexture image, int row,
                int col)
        {
            if (image == null) {
                return null;
            }
            image.LoadTexture();

            int wlength = image.Width / row;
            int hlength = image.Height / col;
            LTexture[][] textures = (LTexture[][])CollectionUtils.XNA_CreateJaggedArray(typeof(LTexture), wlength, hlength);
            for (int y = 0; y < hlength; y++) {
                for (int x = 0; x < wlength; x++) {
                    textures[x][y] = image.GetSubTexture((x * row), (y * col), row,
                            col);
                }
            }
            return textures;
        }
예제 #3
0
 public static LTexture[] GetSplitTextures(LTexture image, int width, int height)
 {
     if (image == null)
     {
         return null;
     }
     image.LoadTexture();
     int frame = 0;
     int wlength = image.Width / width;
     int hlength = image.Height / height;
     int total = wlength * hlength;
     LTexture[] images = new LTexture[total];
     for (int y = 0; y < hlength; y++)
     {
         for (int x = 0; x < wlength; x++)
         {
             images[frame] = image.GetSubTexture((x * width), (y * height), width,
                     height);
             frame++;
         }
     }
     return images;
 }
예제 #4
0
 public void CopyArea(LTexture texture, int x, int y, int width, int height,
         int dx, int dy)
 {
     if (isClose)
     {
         return;
     }
     if (x < 0)
     {
         width += x;
         x = 0;
     }
     if (y < 0)
     {
         height += y;
         y = 0;
     }
     if (texture != null)
     {
         if (x + width > texture.Width)
         {
             width = texture.Height - x;
         }
         if (y + height > texture.Height)
         {
             height = texture.Height - y;
         }
         LTexture tex2d = texture.GetSubTexture(x, y, width, height);
         DrawTexture(tex2d, x + dx, y + dy);
         tex2d = null;
     }
     else
     {
         if (x + width > GetWidth())
         {
             width = GetWidth() - x;
         }
         if (y + height > GetHeight())
         {
             height = GetHeight() - y;
         }
         LTexture tex2d = ScreenUtils.ToScreenCaptureTexture().GetSubTexture(x, y, width,
                 height);
         DrawTexture(tex2d, x + dx, y + dy);
         if (tex2d != null)
         {
             tex2d.Destroy();
             tex2d = null;
         }
     }
 }