Beispiel #1
0
 public static LTexture FilterColor(string res, Color[] colors, Loon.Core.Graphics.Opengl.LTexture.Format format)
 {
     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++)
     {
         for (int j = 0; j < colors.Length; j++)
         {
             if (pixels[i].Equals(colors[j]))
             {
                 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;
 }
Beispiel #2
0
 public override void Draw(Loon.Core.Graphics.Opengl.GLEx g)
 {
     if (IsOnLoadComplete())
     {
         map.Draw(g, 5, 5);
         g.DrawString("Ĭ��֧��(DLL���Դ�)���������ֿ�", 26, 66);
     }
 }
Beispiel #3
0
 public void GetBytes(Loon.Java.ByteBuffer buf, int rangeStart, int rangeEnd)
 {
     sbyte[] buffer = new sbyte[bytes.Length];
     for (int i = 0; i < buffer.Length; i++)
     {
         buffer[i] = (sbyte)bytes[i];
     }
     buf.Put(buffer, rangeStart, MathUtils.Min(bytes.Length, rangeEnd));
 }
Beispiel #4
0
 public override void Draw(Loon.Core.Graphics.Opengl.GLEx g)
 {
     if (IsOnLoadComplete())
     {
         map.Draw(g, 5, 5);
         g.DrawString("Ĭ��֧��(DLL���Դ�)���������ֿ�", 26, 66);
         /*this.renderer.Begin(GLType.Filled);
         this.renderer.SetColor(LColor.red);
         this.renderer.Oval(166, 166, 20);
         this.renderer.End();*/
     }
 }
Beispiel #5
0
        public void What_Kind_Is_Loon()
        {
            //arrange
            Animal Gena     = new Loon();
            string expected = "Bird";

            //act
            string result = Gena.WhatKind;

            //assert
            Assert.Equal(expected, result);
        }
Beispiel #6
0
 public SequenceInputStream(Loon.Java.Generics.JavaListInterface.IIterator<Stream> e)
 {
     this.e = e;
     try
     {
         NextStream();
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine("panic" + ex.Message);
     }
 }
Beispiel #7
0
 public override void TouchDown(Loon.Core.Input.LTouch e)
 {
     if (IsPhysics())
     {
         SpriteBatchObject o = FindObject(e.GetX(), e.GetY());
         if (o == null)
         {
             AddCirclePhysics(false, new TextureObject(e.X(), e.Y(),
                     "ball"));
         }
         else
         {
             Remove(o);
         }
     }
 }
Beispiel #8
0
 public static LTexture LoadTexture(string fileName, Loon.Core.Graphics.Opengl.LTexture.Format format)
 {
     if (fileName == null)
     {
         return null;
     }
     lock (lazyTextures)
     {
         string key = fileName.Trim().ToLower();
         LTexture texture = (LTexture)CollectionUtils.Get(lazyTextures, key);
         if (texture != null && !texture.isClose)
         {
             texture.refCount++;
             return texture;
         }
         texture = new LTexture(fileName, format);
         texture.lazyName = fileName;
         CollectionUtils.Put(lazyTextures, key, texture);
         return texture;
     }
 }
Beispiel #9
0
 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;
 }
Beispiel #10
0
 public virtual void SetSprListerner(Loon.Action.Sprite.Sprites.SpriteListener sprListerner)
 {
     if (sprites == null)
     {
         return;
     }
     sprites.SetSprListerner(sprListerner);
 }
Beispiel #11
0
 public override void TouchMove(Loon.Core.Input.LTouch e)
 {
    
 }
Beispiel #12
0
 public override void TouchDrag(Loon.Core.Input.LTouch e)
 {
   
 }
Beispiel #13
0
  public override void Release(Loon.Core.Input.LKey e)
  {
 
  }
Beispiel #14
0
 public void SetMatrixMode(Loon.Core.Geom.Matrix mx)
 {
     if (isClose)
     {
         return;
     }
     _gl.GLMatrixMode(GL10.GL_MODELVIEW);
     _gl.GLLoadMatrixf(mx.Get(), 0);
 }
Beispiel #15
0
 public void SetFormat(Loon.Core.Graphics.Opengl.LTexture.Format format)
 {
     this.m_format = format;
     this.isUpdate = true;
 }
Beispiel #16
0
 public override void Press(Loon.Core.Input.LKey e)
 {
     
 }
Beispiel #17
0
 public override void Before(Loon.Action.Sprite.SpriteBatch batch)
 {
    
 }
Beispiel #18
0
 public void OnStateLog(Loon.Utils.Debug.Log log)
 {
     StringBuilder sbr = new StringBuilder();
     sbr.Append("Mode:").Append(m_mode);
     log.I(sbr.ToString());
     sbr.Clear();
     sbr.Append("Width:").Append(width).Append(",Height:" + height);
     log.I(sbr.ToString());
     sbr.Clear();
     sbr.Append("MaxWidth:").Append(maxWidth)
             .Append(",MaxHeight:" + maxHeight);
     log.I(sbr.ToString());
     sbr.Clear();
     sbr.Append("Scale:").Append(IsScale());
     log.I(sbr.ToString());
     sbr = null;
 }
Beispiel #19
0
		public void Packed(Loon.Core.Graphics.Opengl.LTexture.Format format) {
			this.Pack(format);
			this.packed = true;
			this.Free();
		}
Beispiel #20
0
 public void RemoveAction(Loon.Action.ActionEvent e)
 {
     Loon.Action.ActionControl.GetInstance().RemoveAction(e);
 }
Beispiel #21
0
        public LTexture Pack(Loon.Core.Graphics.Opengl.LTexture.Format format)
        {
			if (texture != null && !packing) {
				return texture;
			}
			if (fileName != null) {
				texture = new LTexture(GLLoader.GetTextureData(fileName), format);
                texture.isExt = true;
			} else {
				LImage image = PackImage();
				if (image == null) {
					return null;
				}
				if (texture != null) {
					texture.Destroy();
					texture = null;
				}
				if (colorMask != null) {
					Color[] pixels = image.GetPixels();
					int size = pixels.Length;
                    uint color = colorMask.GetRGB();
					for (int i = 0; i < size; i++) {
						if (pixels[i].PackedValue == color) {
							pixels[i].PackedValue = LSystem.TRANSPARENT;
						}
					}
					image.SetPixels(pixels, image.GetWidth(), image.GetHeight());
				}
				texture = new LTexture(GLLoader.GetTextureData(image), format);
                texture.isExt = true;
				if (image != null) {
					image.Dispose();
					image = null;
				}
			}
			return texture;
		}
Beispiel #22
0
        public LTextureRegion(string file, Loon.Core.Graphics.Opengl.LTexture.Format f)
            : this(LTextures.LoadTexture(file, f))
        {

        }
Beispiel #23
0
 public void RemoveAction(Object tag, Loon.Action.Event act)
 {
     Loon.Action.ActionControl.GetInstance().RemoveAction(tag, act);
 }
Beispiel #24
0
 public void RemoveAllActions(Loon.Action.Event act)
 {
     Loon.Action.ActionControl.GetInstance().RemoveAllActions(act);
 }
Beispiel #25
0
 public void AddAction(Loon.Action.ActionEvent e, Loon.Action.Event act)
 {
     Loon.Action.ActionControl.GetInstance().AddAction(e, act);
 }
Beispiel #26
0
 public int Add(string res, Loon.Core.Graphics.Opengl.LTexture.Format format, float x, float y)
 {
     return Add(new LTextureObject(LTextures.LoadTexture(res, format), x, y));
 }
Beispiel #27
0
 public override void Alter(Loon.Core.Timer.LTimerContext timer)
 {
   
 }
Beispiel #28
0
		private void NextSize(Loon.Core.Geom.Point.Point2i size) {
			if (size.x > size.y) {
				size.y <<= 1;
			} else {
				size.x <<= 1;
			}
		}
Beispiel #29
0
        /*public class play : Updateable
        {
            public void Action()
            {
                SoundEffect explosion = LSystem.screenActivity.GameRes.Load<SoundEffect>("Content/decide1");
                explosion.Play();
            }
        }*/

        public override void TouchDown(Loon.Core.Input.LTouch e)
        {
         //   PlaySound("decide1.wav");
            //LSystem.Unload(new play());
          ///  SoundPlayer audio = new SoundPlayer("decide1");
           // audio.Start();
         
           // PlaySound("000");

        }
Beispiel #30
0
		public void SetFormat(Loon.Core.Graphics.Opengl.LTexture.Format format) {
			this.format = format;
		}
Beispiel #31
0
 public override void After(Loon.Action.Sprite.SpriteBatch batch)
 {
    // batch.Draw(font,"ABCD\nEF", 66, 66,LColor.red);
     batch.Draw(font, "Test", new Vector2f(150, 150), LColor.red, 0,
              Vector2f.Zero, new Vector2f(1f, 1f), SpriteEffects.None);
 }