Attachment* AttachmentLoader_newAttachment (AttachmentLoader* self, Skin* skin, AttachmentType type, const char* name) { FREE(self->error1); FREE(self->error2); self->error1 = 0; self->error2 = 0; return VTABLE(AttachmentLoader, self) ->newAttachment(self, skin, type, name); }
Skeleton* _Cocos2dxSkeleton_create (SkeletonData* data, CCSkeleton* node) { Cocos2dxSkeleton* self = NEW(Cocos2dxSkeleton); _Skeleton_init(SUPER(self), data); VTABLE(Skeleton, self) ->dispose = _Cocos2dxSkeleton_dispose; self->node = node; return SUPER(self); }
RegionAttachment* RegionAttachment_create (const char* name, AtlasRegion* region) { Cocos2dxRegionAttachment* self = NEW(Cocos2dxRegionAttachment); _RegionAttachment_init(SUPER(self), name); VTABLE(Attachment, self) ->dispose = _Cocos2dxRegionAttachment_dispose; VTABLE(Attachment, self) ->draw = _Cocos2dxRegionAttachment_draw; Cocos2dxAtlasPage* page = SUB_CAST(Cocos2dxAtlasPage, region->page); self->atlas = page->atlas; const CCSize& size = page->texture->getContentSizeInPixels(); float u = region->x / size.width; float u2 = (region->x + region->width) / size.width; float v = region->y / size.height; float v2 = (region->y + region->height) / size.height; ccV3F_C4B_T2F_Quad* quad = &self->quad; if (region->rotate) { quad->tl.texCoords.u = u; quad->tl.texCoords.v = v2; quad->tr.texCoords.u = u; quad->tr.texCoords.v = v; quad->br.texCoords.u = u2; quad->br.texCoords.v = v; quad->bl.texCoords.u = u2; quad->bl.texCoords.v = v2; } else { quad->bl.texCoords.u = u; quad->bl.texCoords.v = v2; quad->tl.texCoords.u = u; quad->tl.texCoords.v = v; quad->tr.texCoords.u = u2; quad->tr.texCoords.v = v; quad->br.texCoords.u = u2; quad->br.texCoords.v = v2; } quad->bl.vertices.z = 0; quad->tl.vertices.z = 0; quad->tr.vertices.z = 0; quad->br.vertices.z = 0; return SUPER(self); }
AtlasPage* AtlasPage_create (const char* name) { Cocos2dxAtlasPage* self = NEW(Cocos2dxAtlasPage); _AtlasPage_init(SUPER(self), name); VTABLE(AtlasPage, self) ->dispose = _Cocos2dxAtlasPage_dispose; self->texture = CCTextureCache::sharedTextureCache()->addImage(name); self->texture->retain(); self->atlas = CCTextureAtlas::createWithTexture(self->texture, 4); self->atlas->retain(); return SUPER(self); }
void AttachmentLoader_dispose (AttachmentLoader* self) { VTABLE(AttachmentLoader, self) ->dispose(self); FREE(self); }
void Attachment_dispose (Attachment* self) { VTABLE(Attachment, self) ->dispose(self); FREE(self); }