예제 #1
0
        /// <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);
        }
예제 #2
0
 public void __AddDefinition(SymbolDef sd)
 {
     _definitions[sd.SymbolId] = sd;
 }
예제 #3
0
 /// <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);
 }