コード例 #1
0
ファイル: LGradation.cs プロジェクト: keppelcao/LGame
		private LGradation(LColor s, LColor e, int w, int h, int alpha) {
			this.start = s;
			this.end = e;
			this.width = w;
			this.height = h;
			this.alpha = alpha;
		}
コード例 #2
0
 public static LTexture FilterColor(string res, LColor height, Loon.Core.Graphics.Opengl.LTexture.Format format)
 {
     uint color = height.GetRGB();
     LImage tmp = LImage.CreateImage(res);
     LImage image = LImage.CreateImage(tmp.GetWidth(), tmp.GetHeight(), true);
     LGraphics g = image.GetLGraphics();
     g.DrawImage(tmp, 0, 0);
     g.Dispose();
     if (tmp != null)
     {
         tmp.Dispose();
         tmp = null;
     }
     Color[] pixels = image.GetPixels();
     int size = pixels.Length;
     for (int i = 0; i < size; i++)
     {
         if (pixels[i].PackedValue == color)
         {
             pixels[i].PackedValue = LSystem.TRANSPARENT;
         }
     }
     image.SetFormat(format);
     image.SetPixels(pixels, image.GetWidth(), image.GetHeight());
     LTexture texture = image.GetTexture();
     if (image != null)
     {
         image.Dispose();
         image = null;
     }
     return texture;
 }
コード例 #3
0
ファイル: WaitSprite.cs プロジェクト: 207h2Flogintvg/LGame
            public DrawWait(int s, int width, int height)
            {
                this.style = s;
                this.width = width;
                this.height = height;
                this.color = new LColor(1f, 1f, 1f);
                switch (style)
                {
                    case 0:
                        int r1 = width / 8,
                        r2 = height / 8;
                        this.r = ((r1 < r2) ? r1 : r2) / 2;
                        this.list = new List<object>(Arrays.AsList<object>(new object[] {
											new RectBox(sx + 3 * r, sy + 0 * r, 2 * r, 2 * r),
											new RectBox(sx + 5 * r, sy + 1 * r, 2 * r, 2 * r),
											new RectBox(sx + 6 * r, sy + 3 * r, 2 * r, 2 * r),
											new RectBox(sx + 5 * r, sy + 5 * r, 2 * r, 2 * r),
											new RectBox(sx + 3 * r, sy + 6 * r, 2 * r, 2 * r),
											new RectBox(sx + 1 * r, sy + 5 * r, 2 * r, 2 * r),
											new RectBox(sx + 0 * r, sy + 3 * r, 2 * r, 2 * r),
											new RectBox(sx + 1 * r, sy + 1 * r, 2 * r, 2 * r) }));
                        break;
                    case 1:
                        this.Fill = new LColor(165, 0, 0, 255);
                        this.paintX = (width - ARCRADIUS);
                        this.paintY = (height - ARCRADIUS);
                        this.paintWidth = paintX + ARCRADIUS;
                        this.paintHeight = paintY + ARCRADIUS;
                        break;
                }
            }
コード例 #4
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());
        }
コード例 #5
0
ファイル: Label.cs プロジェクト: 207h2Flogintvg/LGame
		public Label(LFont font, string label, int x, int y) {
			this.font = font;
			this.label = label;
			this.color = LColor.black;
			this.visible = true;
			this.SetLocation(x, y);
		}
コード例 #6
0
ファイル: LColorPool.cs プロジェクト: 207h2Flogintvg/LGame
		public LColor GetColor(uint c) {
            LColor color = (LColor)CollectionUtils.Get(ColorMap, c);
			if (color == null) {
				color = new LColor(c);
                CollectionUtils.Put(ColorMap, c, color);
			}
			return color;
		}
コード例 #7
0
ファイル: FadeEffect.cs プロジェクト: 207h2Flogintvg/LGame
		public FadeEffect(LColor c, int delay, int type, int w, int h) {
			this.visible = true;
			this.type = type;
			this.SetDelay(delay);
			this.SetColor(c);
			this.width = w;
			this.height = h;
		}
コード例 #8
0
		public void Draw(int idx, SpriteBatch batch, float x, float y,
				float rotation, float sx, float sy, LColor color) {
			RectBox rect = this._rectList[idx];
			batch.SetColor(color);
			batch.Draw(_texture, x, y, anchor.x, anchor.y, rect.width, rect.height,
					sx, sy, MathUtils.ToDegrees(rotation), rect.x, rect.y,
					rect.width, rect.height, false, false);
			batch.ResetColor();
		}
コード例 #9
0
ファイル: ArcEffect.cs プロジェクト: keppelcao/LGame
 public ArcEffect(LColor c, int x, int y, int width, int height)
 {
     this.SetLocation(x, y);
     this.width = width;
     this.height = height;
     this.timer = new LTimer(200);
     this.color = (c == null) ? LColor.black : c;
     this.visible = true;
 }
コード例 #10
0
		public void Draw(int idx, SpriteBatch batch, Vector2f absPos,
				float rotation, Vector2f scale, LColor color) {
			RectBox rect = this._rectList[idx];
			batch.SetColor(color);
			batch.Draw(_texture, absPos.x, absPos.y, anchor.x, anchor.y,
					rect.width, rect.height, scale.x, scale.y,
					MathUtils.ToDegrees(rotation), rect.x, rect.y, rect.width,
					rect.height, false, false);
			batch.ResetColor();
		}
コード例 #11
0
        public static LTransition NewArc(LColor c)
        {
            if (GLEx.Self != null)
            {

                LTransition transition = new LTransition();
                transition.SetTransitionListener(new _Arc(c));
                transition.SetDisplayGameUI(true);
                transition.code = 1;
                return transition;
            }
            return null;
        }
コード例 #12
0
 public void Draw(GLEx g, int x, int y, int sx, int sy, LColor color)
 {
     if (target.IsBatch())
     {
         float nx = sx * tw;
         float ny = sy * th;
         target.Draw(x, y, tw, th, nx, ny, nx + tw, ny + th, color);
     }
     else
     {
         CheckImage(sx, sy);
         g.DrawTexture(subImages[sx][sy], x, y);
     }
 }
コード例 #13
0
 public static LTexture CreateTexture(int width, int height, LColor c)
 {
     LImage image = LImage.CreateImage(width, height, false);
     LGraphics g = image.GetLGraphics();
     g.SetColor(c);
     g.FillRect(0, 0, width, height);
     g.Dispose();
     LTexture tex2d = image.GetTexture();
     if (image != null)
     {
         image.Dispose();
         image = null;
     }
     return tex2d;
 }
コード例 #14
0
ファイル: LColorPool.cs プロジェクト: 207h2Flogintvg/LGame
		public LColor GetColor(int r, int g, int b, int a) {
			if (a <= 10) {
				return AlphaColor;
			}
			int hashCode = 1;
			hashCode = LSystem.Unite(hashCode, r);
			hashCode = LSystem.Unite(hashCode, g);
			hashCode = LSystem.Unite(hashCode, b);
			hashCode = LSystem.Unite(hashCode, a);
            LColor color = (LColor)CollectionUtils.Get(ColorMap, hashCode);
			if (color == null) {
				color = new LColor(r, g, b, a);
                CollectionUtils.Put(ColorMap, hashCode, color);
			}
			return color;
		}
コード例 #15
0
 public LColor GetColor(float r, float g, float b, float a)
 {
     int hashCode = 1;
     hashCode = LSystem.Unite(hashCode, r);
     hashCode = LSystem.Unite(hashCode, g);
     hashCode = LSystem.Unite(hashCode, b);
     hashCode = LSystem.Unite(hashCode, a);
     LColor color = (LColor)CollectionUtils.Get(colorMap, hashCode);
     if (color == null)
     {
         color = new LColor(r, g, b, a);
         CollectionUtils.Put(colorMap, hashCode
             , color);
     }
     return color;
 }
コード例 #16
0
ファイル: Blood.cs プロジェクト: 207h2Flogintvg/LGame
 public Blood(LColor c, int x, int y)
 {
     this.SetLocation(x, y);
     this.color = c;
     this.timer = new LTimer(20);
     this.drops = new Drop[20];
     this.limit = 50;
     for (int i = 0; i < drops.Length; ++i)
     {
         SetBoolds(i, x, y, 6.0f * (MathUtils.Random() - 0.5f), -2.0f
                 * MathUtils.Random());
     }
     this.xSpeed = 0F;
     this.ySpeed = 0.5F;
     this.step = 0;
     this.visible = true;
 }
コード例 #17
0
ファイル: LGradation.cs プロジェクト: keppelcao/LGame
		public static LGradation GetInstance(LColor s, LColor e, int w, int h,
				int alpha) {
			if (gradations == null) {
                gradations = new Dictionary<string, LGradation>(10);
			}
			int hashCode = 1;
			hashCode = LSystem.Unite(hashCode, s.GetRGB());
			hashCode = LSystem.Unite(hashCode, e.GetRGB());
			hashCode = LSystem.Unite(hashCode, w);
			hashCode = LSystem.Unite(hashCode, h);
			hashCode = LSystem.Unite(hashCode, alpha);
			string key = Convert.ToString(hashCode);
			LGradation o = (LGradation) CollectionUtils.Get(gradations,key);
			if (o == null) {
                CollectionUtils.Put(gradations,key, o = new LGradation(s, e, w, h, alpha));
			}
			return o;
		}
コード例 #18
0
ファイル: StatusBar.cs プロジェクト: keppelcao/LGame
 public LTexture LoadBarColor(LColor c1, LColor c2, LColor c3)
 {
     if (colors.Count > 10)
     {
         lock (colors)
         {
             foreach (LTexture tex2d in colors.Values)
             {
                 if (tex2d != null)
                 {
                     tex2d.Destroy();
                 }
             }
             colors.Clear();
         }
     }
     int hash = 1;
     hash = LSystem.Unite(hash, c1.GetRGB());
     hash = LSystem.Unite(hash, c2.GetRGB());
     hash = LSystem.Unite(hash, c3.GetRGB());
     LTexture texture = null;
     lock (colors)
     {
         texture = (LTexture)CollectionUtils.Get(colors, hash);
     }
     if (texture == null)
     {
         LImage image = LImage.CreateImage(8, 8, false);
         LGraphics g = image.GetLGraphics();
         g.SetColor(c1);
         g.FillRect(0, 0, 4, 4);
         g.SetColor(c2);
         g.FillRect(4, 0, 4, 4);
         g.SetColor(c3);
         g.FillRect(0, 4, 4, 4);
         g.Dispose();
         texture = image.GetTexture();
         CollectionUtils.Put(colors, hash, texture);
     }
     return (this.texture = texture);
 }
コード例 #19
0
ファイル: TextureUtils.cs プロジェクト: keppelcao/LGame
 public static LTexture FilterLimitColor(string res, LColor start,
         LColor end, Loon.Core.Graphics.Opengl.LTexture.Format format)
 {
     int sred = start.R;
     int sgreen = start.G;
     int sblue = start.B;
     int ered = end.R;
     int egreen = end.G;
     int eblue = end.B;
     LImage tmp = LImage.CreateImage(res);
     LImage image = LImage.CreateImage(tmp.GetWidth(), tmp.GetHeight(), true);
     LGraphics g = image.GetLGraphics();
     g.DrawImage(tmp, 0, 0);
     g.Dispose();
     if (tmp != null)
     {
         tmp.Dispose();
         tmp = null;
     }
     Color[] pixels = image.GetPixels();
     int size = pixels.Length;
     for (int i = 0; i < size; i++)
     {
         Color pixel = pixels[i];
         if ((pixel.R >= sred && pixel.G >= sgreen && pixel.B >= sblue)
                 && (pixel.R <= ered && pixel.G <= egreen && pixel.B <= eblue))
         {
             pixels[i].PackedValue = LSystem.TRANSPARENT;
         }
     }
     image.SetFormat(format);
     image.SetPixels(pixels, image.GetWidth(), image.GetHeight());
     LTexture texture = image.GetTexture();
     if (image != null)
     {
         image.Dispose();
         image = null;
     }
     return texture;
 }
コード例 #20
0
ファイル: Cycle.cs プロジェクト: hellogithubtesting/LGame
        public Cycle(List<object[]> path_0, int x_1, int y_2, int w, int h)
        {
            if (path_0 != null)
            {
                CollectionUtils.Add(data, CollectionUtils.ToArray(path_0));
                isUpdate = true;
            }
            else
            {
                data = new List<object[]>(10);
            }

            this.SetLocation(x_1, y_2);
            this.timer = new LTimer(25);
            this.color = LColor.white;
            this.points = new List<CycleProgress>();
            this.multiplier = 1;
            this.pointDistance = 0.05f;
            this.padding = 0;
            this.stepType = 0;
            this.stepsPerFrame = 1;
            this.trailLength = 1;
            this.scaleX = 1;
            this.scaleY = 1;
            this.alpha = 1;
            this.blockWidth = w;
            this.blockHeight = h;
            this.blockHalfWidth = w / 2;
            this.blockHalfHeight = h / 2;
            if (signatures == null)
            {
                signatures = new Dictionary<Int32, float[]>(3);
                CollectionUtils.Put(signatures, ARC, new float[] { 1, 1, 3, 2, 2, 0 });
                CollectionUtils.Put(signatures, BEZIER, new float[] { 1, 1, 1, 1, 1, 1, 1, 1 });
                CollectionUtils.Put(signatures, LINE, new float[] { 1, 1, 1, 1 });
            }
            this.Setup();
            this.isVisible = true;
        }
コード例 #21
0
 public void SetColor(LColor c)
 {
     color.R = c.R;
     color.G = c.G;
     color.B = c.B;
     color.A = (byte)(alpha != 1f ? alpha * 255 : c.A);
 }
コード例 #22
0
ファイル: Screen.cs プロジェクト: 207h2Flogintvg/LGame
 public virtual void SetBackground(LColor c)
 {
     SetRepaintMode(SCREEN_COLOR_REPAINT);
     if (color == null)
     {
         color = new LColor(c);
     }
     else
     {
         color.SetColor(c.r, c.g, c.b, c.a);
     }
 }
コード例 #23
0
ファイル: LTransition.cs プロジェクト: keppelcao/LGame
 public _Arc(LColor c)
 {
     arc = new ArcEffect(c);
 }
コード例 #24
0
ファイル: LTransition.cs プロジェクト: keppelcao/LGame
 public static LTransition NewCrossRandom(LColor c)
 {
     return NewCross(MathUtils.Random(0, 1), TextureUtils
             .CreateTexture(LSystem.screenRect.width,
                     LSystem.screenRect.height, c));
 }
コード例 #25
0
ファイル: LColor.cs プロジェクト: zx8326123/LGame
 public LColor Multiply(LColor c)
 {
     return(new LColor(R * c.R, G * c.G, B * c.B, A * c.A));
 }
コード例 #26
0
 public void SetFilterColor(LColor f)
 {
     this.filterColor.SetColor(f);
 }
コード例 #27
0
 public void DrawString(string s, float x, float y, float rotation,
         LColor c)
 {
     DrawString(s, x, y, rotation, c.Color);
 }
コード例 #28
0
ファイル: LComponent.cs プロジェクト: zx8326123/LGame
 public void SetBackground(LColor color)
 {
     SetBackground(TextureUtils
                   .CreateTexture(GetWidth(), GetHeight(), color));
 }
コード例 #29
0
ファイル: LColor.cs プロジェクト: zx8326123/LGame
 public LColor(LColor color)
 {
     this.xnaColor             = new Color();
     this.xnaColor.PackedValue = color.Color.PackedValue;
 }
コード例 #30
0
ファイル: LColor.cs プロジェクト: zx8326123/LGame
 public uint GetARGB()
 {
     return(LColor.GetARGB(R, G, B, A));
 }
コード例 #31
0
ファイル: LColor.cs プロジェクト: zx8326123/LGame
 public uint GetRGB()
 {
     return(LColor.GetRGB(R, G, B));
 }
コード例 #32
0
ファイル: LColor.cs プロジェクト: zx8326123/LGame
 public void SetARGB(uint pixel)
 {
     byte[] colors = LColor.GetARGBs(pixel);
     SetColor(colors[3], colors[2], colors[1], 255);
 }
コード例 #33
0
 public void DrawPoint(int x, int y, LColor c)
 {
     Color old = color;
     SetColor(c);
     DrawLine(x, y, x + 1, y + 1);
     SetColor(old);
 }
コード例 #34
0
 public void DrawPoints(int[] x, int[] y, LColor c)
 {
     int size = y.Length;
     for (int i = 0; i < size; i++)
     {
         DrawPoint(x[i], y[i], c);
     }
 }
コード例 #35
0
 public static LGradation GetInstance(LColor s, LColor e, int w, int h)
 {
     return(GetInstance(s, e, w, h, 125));
 }
コード例 #36
0
ファイル: TMXTileSet.cs プロジェクト: ordanielcmessias/LGame
        public TMXTileSet(TMXTiledMap map, XMLElement element, bool loadImage)
        {
            this.map = map;
            this.name = element.GetAttribute("name", null);
            this.firstGID = element.GetIntAttribute("firstgid", 0);
            string source = element.GetAttribute("source", "");
            if (!"".Equals(source))
            {
                try
                {
                    Stream ins0 = Resources.OpenStream(map.GetTilesLocation()
                            + "/" + source);
                    XMLDocument doc = XMLParser.Parse(ins0);
                    XMLElement docElement = doc.GetRoot();
                    element = docElement;
                }
                catch (Exception e)
                {
                    Loon.Utils.Debug.Log.Exception(e);
                    throw new Exception(this.map.tilesLocation + "/"
                            + source);
                }
            }
            string tileWidthString = element.GetAttribute("tilewidth", "");
            string tileHeightString = element.GetAttribute("tileheight", "");
            if (tileWidthString.Length == 0 || tileHeightString.Length == 0)
            {
                throw new Exception(
                        "tileWidthString.length == 0 || tileHeightString.length == 0");
            }
            tileWidth = Int32.Parse(tileWidthString);
            tileHeight = Int32.Parse(tileHeightString);

            string sv = element.GetAttribute("spacing", "");
            if ((sv != null) && (!"".Equals(sv)))
            {
                tileSpacing = Int32.Parse(sv);
            }

            string mv = element.GetAttribute("margin", "");
            if ((mv != null) && (!"".Equals(mv)))
            {
                tileMargin = Int32.Parse(mv);
            }

            List<XMLElement> list = element.List("image");
            XMLElement imageNode = list[0];
            string fileName = imageNode.GetAttribute("source", null);

            LColor trans = null;
            string t = imageNode.GetAttribute("trans", null);
            if ((t != null) && (t.Length > 0))
            {
                trans = new LColor(((uint)Convert.ToInt32(t, 16)));
            }

            if (loadImage)
            {
                string path = map.GetTilesLocation() + "/" + fileName;
                LTexture image;
                if (trans != null)
                {
                    image = TextureUtils.FilterColor(path, trans);
                }
                else
                {
                    image = LTextures.LoadTexture(path);
                }
                SetTileSetImage(image);
            }

            List<XMLElement> elements = element.List("tile");
            for (int i = 0; i < elements.Count; i++)
            {
                XMLElement tileElement = elements[i];

                int id = tileElement.GetIntAttribute("id", 0);
                id += firstGID;
                TMXProperty tileProps = new TMXProperty();

                XMLElement propsElement = tileElement
                        .GetChildrenByName("properties");
                List<XMLElement> properties = propsElement.List("property");
                for (int p = 0; p < properties.Count; p++)
                {
                    XMLElement propElement = properties[p];
                    string name_1 = propElement.GetAttribute("name", null);
                    string value_ren = propElement.GetAttribute("value", null);
                    tileProps.SetProperty(name_1, value_ren);
                }
                CollectionUtils.Put(props, id, tileProps);
            }
        }
コード例 #37
0
 public void SetColor(LColor c)
 {
     this.xnaColor.PackedValue = c.xnaColor.PackedValue;
 }
コード例 #38
0
ファイル: LLight.cs プロジェクト: hellogithubtesting/LGame
 public Light(float x, float y, float str, LColor col)
 {
     this.xpos = x;
     this.ypos = y;
     this.strength = str;
     this.color = col;
 }
コード例 #39
0
ファイル: LColor.cs プロジェクト: zx8326123/LGame
 /// <summary>
 /// 直接复制一个Color
 /// </summary>
 ///
 /// <param name="c"></param>
 /// <returns></returns>
 public LColor Copy(LColor c)
 {
     return(new LColor(R, G, B, A));
 }