Exemplo n.º 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());
        }
Exemplo n.º 2
0
 public static LTexture CreateShadowTexture(LTexture texture, float alpha,
         float scale, float angle)
 {
     int width = texture.Width;
     int height = texture.Height;
     LPixmap image = new LPixmap(texture);
     int centerX = width / 2;
     int centerY = height / 2;
     int offsetX = (int)((width - image.Width) / 2);
     int offsetY = (int)((height - image.Height) / 2);
     Loon.Core.Geom.Matrix.Transform2i t = new Loon.Core.Geom.Matrix.Transform2i();
     t.Rotate(angle, centerX, centerY);
     t.Zoom(scale, centerX, centerY);
     LPixmap shadowProcess = new LPixmap(width, height,
             image.IsAlpha());
     shadowProcess.DrawPixmap(image, offsetX, offsetY);
     shadowProcess.Transparency();
     shadowProcess.Mul(255, 0, 0, 0);
     shadowProcess.Mul((int)(alpha * 255), 255, 255, 255);
     shadowProcess.Convolve(LPixmap.GaussianBlurKernel());
     shadowProcess.Transform(t);
     if (image != null)
     {
         image.Dispose();
         image = null;
     }
     return shadowProcess.Texture;
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     if (texture != null)
     {
         texture.Destroy();
         texture = null;
     }
 }
Exemplo n.º 6
0
 public virtual void Dispose()
 {
     if (sakura != null)
     {
         sakura.Destroy();
         sakura = null;
     }
 }
Exemplo n.º 7
0
 public virtual void Dispose()
 {
     if (image != null)
     {
         image.Dispose();
         image = null;
     }
 }
Exemplo n.º 8
0
 public virtual void Dispose()
 {
     if (snow != null)
     {
         snow.Destroy();
         snow = null;
     }
 }
Exemplo n.º 9
0
 public virtual void Dispose()
 {
     if (rain != null)
     {
         rain.Destroy();
         rain = null;
     }
 }
Exemplo n.º 10
0
 public OutEffect(LTexture t, RectBox limit, int code)
 {
     this.texture = t;
     this.type = code;
     this.width = t.Width;
     this.height = t.Height;
     this.multiples = 1;
     this.limit = limit;
     this.visible = true;
 }
Exemplo n.º 11
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;
 }
Exemplo n.º 12
0
 public ScrollEffect(int d, LTexture tex2d, float x, float y, int w, int h)
 {
     this.SetLocation(x, y);
     this.texture = tex2d;
     this.width = w;
     this.height = h;
     this.count = 1;
     this.timer = new LTimer(10);
     this.visible = true;
     this.code = d;
 }
Exemplo n.º 13
0
 public LTextureRegion(LTexture texture, int x, int y, int width, int height)
 {
     if (texture == null)
     {
         throw new ArgumentException("texture cannot be null.");
     }
     this.texture = texture;
     this.widthRatio = 1f;
     this.heightRatio = 1f;
     SetRegion(x, y, width, height);
 }
Exemplo n.º 14
0
 public LTextureRegion(LTexture texture)
 {
     if (texture == null)
     {
         throw new ArgumentException("texture cannot be null.");
     }
     this.texture = texture;
     this.widthRatio = 1f;
     this.heightRatio = 1f;
     SetRegion(0, 0, texture.texWidth, texture.texHeight);
 }
Exemplo n.º 15
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;
 }
Exemplo n.º 16
0
 public static void Dispose(LTexture[] images)
 {
     if (images == null)
     {
         return;
     }
     for (int i = 0; i < images.Length; i++)
     {
         images[i].Dispose();
         images[i] = null;
     }
 }
Exemplo n.º 17
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;
 }
Exemplo n.º 18
0
 public void Dispose()
 {
     this.isClose = true;
     if (displayList != null) {
     displayList.Destroy();
     displayList = null;
     }
     if (displays != null) {
     displays.Clear();
     displays = null;
     }
 }
Exemplo n.º 19
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();
 }
Exemplo n.º 20
0
 public static LTransition NewCross(int c, LTexture texture)
 {
     if (GLEx.Self != null)
     {
         LTransition transition = new LTransition();
         transition.SetTransitionListener(new _Cross(c, texture));
         transition.SetDisplayGameUI(true);
         transition.code = 1;
         return transition;
     }
     return null;
 }
Exemplo n.º 21
0
 public SpriteRegion(LTexture texture, int srcX, int srcY, int srcWidth,
         int srcHeight)
 {
     if (texture == null)
     {
         throw new ArgumentException("texture cannot be null.");
     }
     this.texture = texture;
     SetRegion(srcX, srcY, srcWidth, srcHeight);
     SetColor(1f, 1f, 1f, 1f);
     SetSize(Math.Abs(srcWidth), Math.Abs(srcHeight));
     SetOrigin(width / 2, height / 2);
 }
Exemplo n.º 22
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();
 }
Exemplo n.º 23
0
 public AVGScreen(string initscript, LTexture img)
 {
     if (initscript == null)
     {
         return;
     }
     this.scriptName = initscript;
     if (img != null)
     {
         this.dialogFileName = img.GetFileName();
         this.dialog = img;
     }
 }
Exemplo n.º 24
0
 public override void CreateUI(GLEx g, int x, int y, LComponent component,
         LTexture[] buttonImage)
 {
     if (visible && goalPath != null)
     {
         g.SetLineWidth(lineWidth);
         g.GLBegin(GL.GL_LINE_STRIP);
         g.Draw(goalPath, color);
         g.GLEnd();
         g.ResetLineWidth();
         g.ResetColor();
     }
 }
Exemplo n.º 25
0
 public LControl(int x, int y, LTexture bs, LTexture dot, int bw, int bh,
         int dw, int dh)
     : base(x, y, bw, bh)
 {
     this.controlBase = bs;
     this.controlDot = dot;
     this.baseWidth = bw;
     this.baseHeight = bh;
     this.dotWidth = dw;
     this.dotHeight = dh;
     this.allowDiagonal = true;
     this.CenterOffset();
 }
Exemplo n.º 26
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;
 }
Exemplo n.º 27
0
 public StatusBar(int value_ren, int max, int x, int y, int width, int height)
 {
     quoteCount++;
     this.value_ren = value_ren;
     this.valueMax = max;
     this.valueMin = value_ren;
     this.current = (width * value_ren) / valueMax;
     this.goal = (width * valueMin) / valueMax;
     this.width = width;
     this.height = height;
     this.visible = true;
     this.hit = true;
     this.texture = LoadBarColor(Color.Gray, Color.Red, Color.Orange);
     this.SetLocation(x, y);
 }
Exemplo n.º 28
0
 public void Begin()
 {
     if (drawing)
     {
         throw new InvalidOperationException("Not implemented end !");
     }
     if (!isInit)
     {
         batch = new Microsoft.Xna.Framework.Graphics.SpriteBatch(GLEx.device);
         isInit = true;
     }
     lastTexture = null;
     mode = -1;
     idx = 0;
     drawing = true;
 }
Exemplo n.º 29
0
 public override void CreateUI(GLEx g, int x, int y, LComponent component,
         LTexture[] buttonImage)
 {
     LButton button = (LButton)component;
     if (buttonImage != null)
     {
         if (!button.IsEnabled())
         {
             g.DrawTexture(buttonImage[3], x, y);
         }
         else if (button.IsTouchPressed())
         {
             g.DrawTexture(buttonImage[2], x, y);
         }
         else if (button.IsTouchOver())
         {
             g.DrawTexture(buttonImage[1], x, y);
         }
         else
         {
             if (type == 1)
             {
                 g.DrawTexture(buttonImage[0], x, y, LColor.gray);
             }
             else
             {
                 g.DrawTexture(buttonImage[0], x, y);
             }
         }
     }
     if (text != null)
     {
         LFont old = g.GetFont();
         g.SetFont(font);
         g.SetColor(fontColor);
         g.DrawString(
                 text,
                 x + button.GetOffsetLeft()
                         + (button.GetWidth() - font.StringWidth(text)) / 2,
                 y + button.GetOffsetTop()
                         + (button.GetHeight() - font.GetLineHeight()) / 2
                         + font.GetLineHeight());
         g.SetFont(old);
         g.ResetColor();
     }
 }
Exemplo n.º 30
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;
 }