Exemplo n.º 1
0
Attachment* _AtlasAttachmentLoader_newAttachment (AttachmentLoader* loader, Skin* skin, AttachmentType type, const char* name) {
	AtlasAttachmentLoader* self = SUB_CAST(AtlasAttachmentLoader, loader);
	switch (type) {
	case ATTACHMENT_REGION: {
		AtlasRegion* region = Atlas_findRegion(self->atlas, name);
		if (!region) {
			_AttachmentLoader_setError(loader, "Region not found: ", name);
			return 0;
		}
		return SUPER_CAST(Attachment, RegionAttachment_create(name, region)) ;
	}
	default:
		_AttachmentLoader_setUnknownTypeError(loader, type);
		return 0;
	}
}
Exemplo n.º 2
0
void _AttachmentLoader_setUnknownTypeError (AttachmentLoader* self, AttachmentType type) {
	char buffer[16];
	sprintf(buffer, "%d", type);
	_AttachmentLoader_setError(self, "Unknown attachment type: ", buffer);
}