/// <summary> /// Adds the image sprite definition. /// </summary> /// <returns> /// The image sprite definition. /// </returns> /// <param name='classId'> /// Class identifier. /// </param> /// <param name='texturePath'> /// Texture path. /// </param> /// <param name='spriteArea'> /// Texture rectangle. Defautls to using entire texture. /// </param> /// <param name='registrationPoint'> /// Registration point of the definition. Defaults to center. /// </param> public static SymbolDef AddImageSpriteDefinition(string classId, string texturePath, Rect?spriteArea, RegistrationPoint?registrationPoint = null) { var sd = new SymbolDef(); sd.SymbolId = classId; sd.ObjectType = SymbolDef.IMAGE_SPRITE_OBJECT; sd.TexturePath = texturePath; var sa = spriteArea.GetValueOrDefault(new Rect()); sd.Left = sa.x; sd.Top = sa.y; sd.Width = sa.width; sd.Height = sa.height; sd.RegistrationPoint = registrationPoint.GetValueOrDefault(RegistrationPoint.Center); Instance.__AddDefinition(sd); return(sd); }
public void __AddDefinition(SymbolDef sd) { _definitions[sd.SymbolId] = sd; }
/// <summary> /// Adds a definition for a symbol. /// </summary> /// <param name='sd'> /// The definition to add. /// </param> public static void AddDefinition(SymbolDef sd) { Instance.__AddDefinition(sd); }