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; }
public override void Draw(Loon.Core.Graphics.Opengl.GLEx g) { if (IsOnLoadComplete()) { map.Draw(g, 5, 5); g.DrawString("Ĭ��֧��(DLL���Դ�)���������ֿ�", 26, 66); } }
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)); }
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();*/ } }
public void What_Kind_Is_Loon() { //arrange Animal Gena = new Loon(); string expected = "Bird"; //act string result = Gena.WhatKind; //assert Assert.Equal(expected, result); }
public SequenceInputStream(Loon.Java.Generics.JavaListInterface.IIterator<Stream> e) { this.e = e; try { NextStream(); } catch (Exception ex) { Console.Error.WriteLine("panic" + ex.Message); } }
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); } } }
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; } }
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; }
public virtual void SetSprListerner(Loon.Action.Sprite.Sprites.SpriteListener sprListerner) { if (sprites == null) { return; } sprites.SetSprListerner(sprListerner); }
public override void TouchMove(Loon.Core.Input.LTouch e) { }
public override void TouchDrag(Loon.Core.Input.LTouch e) { }
public override void Release(Loon.Core.Input.LKey e) { }
public void SetMatrixMode(Loon.Core.Geom.Matrix mx) { if (isClose) { return; } _gl.GLMatrixMode(GL10.GL_MODELVIEW); _gl.GLLoadMatrixf(mx.Get(), 0); }
public void SetFormat(Loon.Core.Graphics.Opengl.LTexture.Format format) { this.m_format = format; this.isUpdate = true; }
public override void Press(Loon.Core.Input.LKey e) { }
public override void Before(Loon.Action.Sprite.SpriteBatch batch) { }
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; }
public void Packed(Loon.Core.Graphics.Opengl.LTexture.Format format) { this.Pack(format); this.packed = true; this.Free(); }
public void RemoveAction(Loon.Action.ActionEvent e) { Loon.Action.ActionControl.GetInstance().RemoveAction(e); }
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; }
public LTextureRegion(string file, Loon.Core.Graphics.Opengl.LTexture.Format f) : this(LTextures.LoadTexture(file, f)) { }
public void RemoveAction(Object tag, Loon.Action.Event act) { Loon.Action.ActionControl.GetInstance().RemoveAction(tag, act); }
public void RemoveAllActions(Loon.Action.Event act) { Loon.Action.ActionControl.GetInstance().RemoveAllActions(act); }
public void AddAction(Loon.Action.ActionEvent e, Loon.Action.Event act) { Loon.Action.ActionControl.GetInstance().AddAction(e, act); }
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)); }
public override void Alter(Loon.Core.Timer.LTimerContext timer) { }
private void NextSize(Loon.Core.Geom.Point.Point2i size) { if (size.x > size.y) { size.y <<= 1; } else { size.x <<= 1; } }
/*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"); }
public void SetFormat(Loon.Core.Graphics.Opengl.LTexture.Format format) { this.format = format; }
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); }