Пример #1
0
 public void SetRegion(LTexture texture)
 {
     this.texture     = texture;
     this.widthRatio  = 1f;
     this.heightRatio = 1f;
     SetRegion(0, 0, texture.GetWidth(), texture.GetHeight());
 }
Пример #2
0
 public LMessage(LTexture formImage, int x, int y, int width, int height)
     : base(x, y, width, height)
 {
     this.animation = new Animation();
     if (formImage == null)
     {
         this.SetBackground(new LTexture(width, height, true));
         this.SetAlpha(0.3F);
     }
     else
     {
         this.SetBackground(formImage);
         if (width == -1)
         {
             width = formImage.GetWidth();
         }
         if (height == -1)
         {
             height = formImage.GetHeight();
         }
     }
     this.print = new Print(GetLocation(), messageFont, width, height);
     if (XNAConfig.IsActive())
     {
         this.SetTipIcon(XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "creese.png"));
     }
     this.totalDuration = 80;
     this.customRendering = true;
     this.SetWait(false);
     this.SetElastic(true);
     this.SetLocked(true);
     this.SetLayer(100);
 }
Пример #3
0
 public LPad(int x, int y, LTexture b, LTexture f, LTexture d, float scale)
     : base(x, y, (int)(f.GetWidth() * scale), (int)(f.GetHeight() * scale))
 {
     this.offsetX = 6 * scale;
     this.offsetY = 6 * scale;
     this.fore = f;
     this.back = b;
     this.dot = d;
     this.dotWidth = (int)(d.GetWidth() * scale);
     this.dotHeight = (int)(d.GetHeight() * scale);
     this.baseWidth = (int)(f.GetWidth() * scale);
     this.baseHeight = (int)(f.GetHeight() * scale);
     this.backWidth = (int)(b.GetWidth() * scale);
     this.backHeight = (int)(b.GetHeight() * scale);
     this.centerX = (baseWidth - dotWidth) / 2 + offsetX;
     this.centerY = (baseHeight - dotHeight) / 2 + offsetY;
     this.scale_pad = scale;
 }
Пример #4
0
        public void SetRegion(int x, int y, int width, int height)
        {
            float invTexWidth  = (1f / texture.GetWidth()) * texture.widthRatio;
            float invTexHeight = (1f / texture.GetHeight()) * texture.heightRatio;

            SetRegion(x * invTexWidth + texture.xOff, y * invTexHeight
                      + texture.yOff, (x + width) * invTexWidth, (y + height)
                      * invTexHeight);
        }
Пример #5
0
 public SpriteSheet(LTexture img, int tw, int th, int s, int m)
 {
     this.width = img.GetWidth();
     this.height = img.GetHeight();
     this.target = img;
     this.tw = tw;
     this.th = th;
     this.margin = m;
     this.spacing = s;
 }
Пример #6
0
 public RainKernel(int n, int w, int h)
 {
     id = n;
     rain = XNAConfig.LoadTexture("rain_" + n + ".png");
     rainWidth = rain.GetWidth();
     rainHeight = rain.GetHeight();
     width = w;
     height = h;
     offsetX = 0;
     offsetY = (5 - n) * 30 + 75 + MathUtils.Random() * 15;
 }
Пример #7
0
 public Picture(LTexture i, int x, int y)
 {
     this.alpha = 1f;
     if (i != null)
     {
         this.SetImage(i);
         this.width = i.GetWidth();
         this.height = i.GetHeight();
     }
     this.SetLocation(x, y);
     this.visible = true;
 }
Пример #8
0
 public SnowKernel(int n, int w, int h)
 {
     snow = XNAConfig
             .LoadTexture("snow_" + n + ".png");
     snowWidth = snow.GetWidth();
     snowHeight = snow.GetHeight();
     width = w;
     height = h;
     offsetX = 0;
     offsetY = n * 0.6f + 1.9f + MathUtils.Random() * 0.2f;
     speed = MathUtils.Random();
 }
Пример #9
0
 public PetalKernel(int n, int w, int h)
 {
     id = n;
     sakura = XNAConfig.LoadTexture("sakura_"
                     + n + ".png");
     sakuraWidth = sakura.GetWidth();
     sakuraHeight = sakura.GetHeight();
     width = w;
     height = h;
     offsetX = 0;
     offsetY = n * 0.6f + 1.9f + MathUtils.Random() * 0.2f;
     speed = MathUtils.Random();
 }
Пример #10
0
 public CrossEffect(int c, LTexture o, LTexture n)
 {
     this.code = c;
     this.otexture = o;
     this.ntexture = n;
     this.width = o.GetWidth();
     this.height = o.GetHeight();
     if (width > height) {
     maxcount = 16;
     } else {
     maxcount = 8;
     }
     this.timer = new LTimer(160);
     this.visible = true;
 }
Пример #11
0
 public SplitEffect(LTexture t, RectBox limit_0, int d)
 {
     this.texture = t;
     this.width = texture.GetWidth();
     this.height = texture.GetHeight();
     this.halfWidth = width / 2;
     this.halfHeight = height / 2;
     this.multiples = 2;
     this.direction = d;
     this.limit = limit_0;
     this.timer = new LTimer(10);
     this.visible = true;
     this.v1 = new Vector2f();
     this.v2 = new Vector2f();
     switch (direction)
     {
         case Config.UP:
         case Config.DOWN:
             special = true;
             {
                 v1.Set(0, 0);
                 v2.Set(halfWidth, 0);
                 break;
             }
         case Config.TLEFT:
         case Config.TRIGHT:
             v1.Set(0, 0);
             v2.Set(halfWidth, 0);
             break;
         case Config.LEFT:
         case Config.RIGHT:
             special = true;
             {
                 v1.Set(0, 0);
                 v2.Set(0, halfHeight);
                 break;
             }
         case Config.TUP:
         case Config.TDOWN:
             v1.Set(0, 0);
             v2.Set(0, halfHeight);
             break;
     }
 }
Пример #12
0
 public SpriteRegion(LTexture texture)
     : this(texture, 0, 0, texture.GetWidth(), texture.GetHeight())
 {
 }
Пример #13
0
 public LInfo(LTexture formImage, int x, int y, int width, int height)
     : base(x, y, width, height)
 {
     fontSize = deffont.GetSize();
     if (formImage == null)
     {
         this.SetBackground(new LTexture(width, height, true));
         this.SetAlpha(0.3F);
     }
     else
     {
         this.SetBackground(formImage);
         if (width == -1)
         {
             width = formImage.GetWidth();
         }
         if (height == -1)
         {
             height = formImage.GetHeight();
         }
     }
     this.message_char_count = 0;
     this.message_x = new int[messageCountMax];
     this.message_y = new int[messageCountMax];
     this.locatePoint = new List<LocatePoint>();
     this.flag = new FlagImage(this);
     this.customRendering = true;
     this.SetElastic(true);
     this.SetLayer(100);
 }
Пример #14
0
 public LInfo(LTexture formImage, int x, int y)
     : this(formImage, x, y, formImage.GetWidth(), formImage.GetHeight())
 {
 }
Пример #15
0
 public virtual void CreateUI(GLEx g)
 {
     if (!visible) {
         return;
     }
     image = animation.GetSpriteImage();
     if (image == null) {
         return;
     }
     float width = (image.GetWidth() * scaleX);
     float height = (image.GetHeight() * scaleY);
     if (filterColor == null) {
         if (alpha > 0 && alpha < 1) {
             g.SetAlpha(alpha);
         }
         if (LTrans.TRANS_NONE == transform) {
             g.DrawTexture(image, X(), Y(), width, height, rotation);
         } else {
             g.DrawRegion(image, 0, 0, GetWidth(), GetHeight(), transform,
                     X(), Y(), LTrans.TOP | LTrans.LEFT);
         }
         if (alpha > 0 && alpha < 1) {
             g.SetAlpha(1);
         }
         return;
     } else {
         Color old = g.GetColor();
         if (alpha > 0 && alpha < 1) {
             g.SetAlpha(alpha);
         }
         g.SetColor(filterColor);
         if (LTrans.TRANS_NONE == transform) {
             g.DrawTexture(image, X(), Y(), width, height, rotation);
         } else {
             g.DrawRegion(image, 0, 0, GetWidth(), GetHeight(), transform,
                     X(), Y(), LTrans.TOP | LTrans.LEFT);
         }
         g.SetColor(old);
         if (alpha > 0 && alpha < 1) {
             g.SetAlpha(1);
         }
         return;
     }
 }
Пример #16
0
 public EmulatorButton(LTexture img, int w, int h, int x, int y, bool flag)
     : this(img, w, h, x, y, flag, img.GetWidth(), img.GetHeight())
 {
 }
Пример #17
0
 public virtual void SetBackground(LTexture background)
 {
     if (background != null)
     {
         SetRepaintMode(SCREEN_BITMAP_REPAINT);
         LTexture screen = null;
         if (background.GetWidth() != GetWidth() || background.GetHeight() != GetHeight())
         {
             screen = background.Scale(GetWidth(), GetHeight());
         }
         else
         {
             screen = background;
         }
         LTexture tmp = currentScreen;
         currentScreen = screen;
         if (tmp != null)
         {
             tmp.Destroy();
             tmp = null;
         }
     }
     else
     {
         SetRepaintMode(SCREEN_CANVAS_REPAINT);
     }
 }
Пример #18
0
 public void SetImageUI(int index, LTexture imageUIs)
 {
     if (imageUIs != null)
     {
         this.width = imageUIs.GetWidth();
         this.height = imageUIs.GetHeight();
     }
     this.imageUI[index] = imageUIs;
 }
Пример #19
0
 private void Init(LTexture tex2d, float limit, bool remove, float scale)
 {
     this.isVisible = true;
     this.expandLimit = limit;
     this.width = tex2d.GetWidth();
     this.height = tex2d.GetHeight();
     this.scaleWidth = (int) (width * scale);
     this.scaleHeight = (int) (height * scale);
     this.loopMaxCount = (MathUtils.Max(scaleWidth, scaleHeight) / 2) + 1;
     this.fractions = new float[(scaleWidth * scaleHeight) * maxElements];
     this.exWidth = (int) (scaleWidth * expandLimit);
     this.exHeigth = (int) (scaleHeight * expandLimit);
     LPixmap image = tex2d.GetImage().ScaledInstance(scaleWidth, scaleHeight);
     Color[] pixels = image.GetData();
     if (image != null) {
     image.Dispose();
     image = null;
     }
     this.size = pixels.Length;
     this.pixmap = new LPixmapData(exWidth, exHeigth, true);
     int no = 0, idx = 0;
     int length = fractions.Length;
     float angle = 0;
     float speed = 0;
     System.Random random = LSystem.random;
     for (int y = 0; y < scaleHeight; y++) {
     for (int x = 0; x < scaleWidth; x++) {
         if (idx + maxElements < length) {
             no = y * scaleWidth + x;
             angle = random.Next(360);
             speed = 10f / random.Next(30);
             fractions[idx + 0] = x;
             fractions[idx + 1] = y;
             fractions[idx + 2] = (MathUtils.Cos(angle * MathUtils.PI
                     / 180) * speed);
             fractions[idx + 3] = (MathUtils.Sin(angle * MathUtils.PI
                     / 180) * speed);
             fractions[idx + 4] = (pixels[no].PackedValue == 0xff00 ? 0xffffff
                     : pixels[no].PackedValue);
             fractions[idx + 5] = x / 6 + random.Next(10);
             idx += maxElements;
         }
     }
     }
     if (remove) {
     if (tex2d != null) {
         tex2d.Destroy();
         tex2d = null;
     }
     }
     this.tmp = tex2d;
     this.StartUsePixelThread();
 }
Пример #20
0
 private void Load(string script)
 {
     string[] op = StringUtils.Split(script, "=");
     if (op.Length == 2)
     {
         string key = op[0].Trim();
         string value_ren = op[1].Trim();
         if ("path".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             path = value_ren.Replace("\"", "");
             if (texture != null)
             {
                 texture.Destroy();
                 texture = null;
             }
             if (GLEx.Self != null)
             {
                 texture = new LTexture(path);
                 imageWidth = texture.GetWidth();
                 imageHeight = texture.GetHeight();
             }
         }
         if ("imagewidth".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             if (NumberUtils.IsNan(value_ren))
             {
                 imageWidth = Int32.Parse(value_ren);
             }
         }
         else if ("alpha".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             if (NumberUtils.IsNan(value_ren))
             {
                 alpha = Single.Parse(value_ren, JavaRuntime.NumberFormat);
             }
         }
         else if ("angle".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             if (NumberUtils.IsNan(value_ren))
             {
                 angle = Single.Parse(value_ren, JavaRuntime.NumberFormat);
             }
         }
         else if ("color".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             string[] p = StringUtils.Split(value_ren, ",");
             if (p.Length > 2 && p.Length < 5)
             {
                 for (int i = 0; i < p.Length; i++)
                 {
                     p[i] = p[i].Replace("^[\\t ]*", "").Replace(
                             "[\\t ]*$", "");
                 }
                 if (p.Length == 3)
                 {
                     color = new LColor(Int32.Parse(p[0]),
                             Int32.Parse(p[1]), Int32.Parse(p[2]));
                 }
                 if (p.Length == 4)
                 {
                     color = new LColor(Int32.Parse(p[0]),
                             Int32.Parse(p[1]), Int32.Parse(p[2]),
                             Int32.Parse(p[3]));
                 }
             }
         }
         else if ("imageheight".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             if (NumberUtils.IsNan(value_ren))
                 imageHeight = Int32.Parse(value_ren);
         }
         else if ("width".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             if (NumberUtils.IsNan(value_ren))
             {
                 width = Int32.Parse(value_ren);
             }
         }
         else if ("height".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             if (NumberUtils.IsNan(value_ren))
             {
                 height = Int32.Parse(value_ren);
             }
         }
         else if ("time".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             if (NumberUtils.IsNan(value_ren))
             {
                 tmp_time = Int32.Parse(value_ren);
             }
         }
         else if ("pos".Equals(key, StringComparison.InvariantCultureIgnoreCase))
         {
             string[] p_0 = StringUtils.Split(value_ren, ",");
             for (int i_1 = 0; i_1 < p_0.Length; i_1++)
             {
                 p_0[i_1] = p_0[i_1].Replace("^[\\t ]*", "").Replace(
                         "[\\t ]*$", "");
             }
             switch (p_0.Length)
             {
                 case 1:
                     if (NumberUtils.IsNan(p_0[0]))
                     {
                         CollectionUtils.Add(posxTmps, Int32.Parse(p_0[0]));
                         CollectionUtils.Add(posyTmps, Int32.Parse(p_0[0]));
                         CollectionUtils.Add(time, tmp_time);
                         alltime += tmp_time;
                     }
                     break;
                 case 2:
                     if (NumberUtils.IsNan(p_0[0]) && NumberUtils.IsNan(p_0[1]))
                     {
                         CollectionUtils.Add(posxTmps, Int32.Parse(p_0[0]));
                         CollectionUtils.Add(posyTmps, Int32.Parse(p_0[1]));
                         CollectionUtils.Add(time, tmp_time);
                         alltime += tmp_time;
                     }
                     break;
             }
         }
     }
 }
Пример #21
0
 public void SetImage(LTexture image_0)
 {
     this.image = image_0;
     this.width = image_0.GetWidth();
     this.height = image_0.GetHeight();
 }
Пример #22
0
 public CollisionMask(LTexture.Mask d)
 {
     Set(d, 0, 0, d.GetWidth(), d.GetHeight());
 }
Пример #23
0
 public void SetRegion(LTexture texture)
 {
     this.texture = texture;
     this.widthRatio = 1f;
     this.heightRatio = 1f;
     SetRegion(0, 0, texture.GetWidth(), texture.GetHeight());
 }
Пример #24
0
 public void SetClickImage(LTexture on, LTexture un)
 {
     if (un == null)
     {
         return;
     }
     if (bitmap != null)
     {
         bitmap.Dispose();
         bitmap = null;
     }
     if (bitmap1 != null)
     {
         bitmap1.Dispose();
         bitmap1 = null;
     }
     this.bitmap = (un == null) ? on : un;
     this.bitmap1 = (on == null) ? un : on;
     this.SetSize(un.GetWidth(), un.GetHeight());
 }
Пример #25
0
 public LButton(LTexture img, string t, int x, int y)
     : this(img, t, img.GetWidth(), img.GetHeight(), x, y)
 {
 }
Пример #26
0
 public void SetBackground(LTexture background)
 {
     if (background == null)
     {
         return;
     }
     LTexture oldImage = this.background;
     if (oldImage != background && oldImage != null)
     {
         oldImage.Destroy();
         oldImage = null;
     }
     this.background = background;
     this.SetAlpha(1.0F);
     this.width = background.GetWidth();
     this.height = background.GetHeight();
     if (this.width <= 0)
     {
         this.width = 1;
     }
     if (this.height <= 0)
     {
         this.height = 1;
     }
 }
Пример #27
0
 public void SetImage(string fileName)
 {
     this.image = new LTexture(fileName);
     this.width = image.GetWidth();
     this.height = image.GetHeight();
 }