public static LNFrameStruct InitWithImageName(string imgName) { DefImage image = LNDataCache.ImageByKey(imgName); LNFrameStruct struct2 = new LNFrameStruct(); if (image.maskColor == null) { struct2._texture = LTextures.LoadTexture(image.fileName, Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR); } else { struct2._texture = TextureUtils.FilterColor(image.fileName, image.maskColor, Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR); } struct2._state = image.blend; struct2._textCoords = image.pos; struct2._orig_width = image.orig.X(); struct2._orig_height = image.orig.Y(); struct2._size_width = image.size.X(); struct2._size_height = image.size.Y(); struct2._anchor = image.anchor; struct2._place = image.place; return(struct2); }
public void InitButtonWithTextureTwinkle(string fsName1, string fsName2) { this.fs = LNDataCache.GetFrameStruct(fsName1); LNAnimation anim = new LNAnimation("Frame", 0.1f, fsName1, fsName2); LNSprite sprite = new LNSprite(); sprite.AddAnimation(anim); sprite.SetFrame("Frame", 0); CollectionUtils.Put(this._buttonElement, "Image", sprite); base.AddNode(sprite, 0); base.SetNodeSize(sprite.GetWidth(), sprite.GetHeight()); base.SetAnchor(new Vector2f(base.GetWidth() / 2f, base.GetHeight() / 2f)); LNAction action = LNSequence.Action(LNFrameAction.Action("Frame", 1)); action.AssignTarget(sprite); LNAction action2 = LNSequence.Action(LNFrameAction.Action("Frame", 0)); action2.AssignTarget(sprite); LNAction action3 = LNSequence.Action( LNRepeat.Action(LNAnimate.Action(anim), 1), LNFrameAction.Action("Frame", 0)); action3.AssignTarget(sprite); CollectionUtils.Put(this._touchBeganAction, "Image", action); CollectionUtils.Put(this._touchMoveOutAction, "Image", action2); CollectionUtils.Put(this._touchClickedAction, "Image", action3); }
public override void DefinitionObjectDidFinishParsing() { base.DefinitionObjectDidFinishParsing(); if (animation != null) { LNDataCache.SetAnimation(this, this.uniqueID); } }
internal DefImage(string uid, string name, Vector2f p, Vector2f o, Vector2f a, Vector2f pl) { this.uniqueID = uid; this.pos = p; this.orig = o; this.anchor = a; this.place = pl; this.fileName = name; LNDataCache.SetImage(this, this.uniqueID); }
public LNLabelAtlas(string fsName, LNLabelAtlas.LabelType type, string text, char startchar, int itemWidth, int itemHeight, int charWidth) : base(fsName, itemWidth, itemHeight) { this.fs = LNDataCache.GetFrameStruct(fsName); base._left = (int)this.fs._textCoords.x; base._top = (int)this.fs._textCoords.y; this._type = type; this._charWidth = charWidth; this._startchar = startchar; this.SetString(text); }
public LNAtlasNode(string fsName, int tileWidth, int tileHeight) { try { this._itemWidth = tileWidth; this._itemHeight = tileHeight; LTexture texture = LNDataCache.GetFrameStruct(fsName)._texture; this._itemsPerRow = texture.GetWidth() / tileWidth; this._itemsPerColumn = texture.GetHeight() / tileHeight; this._textureAtlas = new LNTextureAtlas(texture, this._itemsPerRow * this._itemsPerColumn); } catch (Exception) { throw new Exception( "LNAtlasNode Exception in the data load : " + fsName); } }
public LNSprite(string fsName) : base() { this._ans = null; LNFrameStruct struc0 = LNDataCache.GetFrameStruct(fsName); if (struc0 == null) { throw new Exception(""); } this._texture = struc0._texture; base._left = struc0._textCoords.X(); base._top = struc0._textCoords.Y(); base._orig_width = struc0._orig_width; base._orig_height = struc0._orig_height; base.SetNodeSize(struc0._size_width, struc0._size_height); base._anchor.Set(struc0._anchor); blendState = struc0._state; if (!struc0._place.Equals(0, 0)) { SetPosition(struc0._place); } }
public static LNSprite GInitWithFrameStruct(string fsName) { return(GInitWithFrameStruct(LNDataCache.GetFrameStruct(fsName))); }
public override void DefinitionObjectDidFinishParsing() { base.DefinitionObjectDidFinishParsing(); LNDataCache.SetImage(this, this.uniqueID); }