| 733 | } |
| 734 | |
| 735 | bool ResourcePool::LoadImage(const char* name, const char* texname, |
| 736 | double x, double y, double w, double h, double a, double b, bool rect)LNOEXCEPT |
| 737 | { |
| 738 | LDEBUG_RESOURCETIMER; |
| 739 | |
| 740 | { |
| 741 | LDEBUG_RESOURCESCOPE; |
| 742 | |
| 743 | LASSERT(LAPP.GetRenderer()); |
| 744 | |
| 745 | if (m_SpritePool.find(name) != m_SpritePool.end()) |
| 746 | { |
| 747 | LWARNING("LoadImage: ͼ��'%m'�Ѵ��ڣ����ز����ѱ�ȡ��", name); |
| 748 | return true; |
| 749 | } |
| 750 | |
| 751 | fcyRefPointer<ResTexture> pTex = m_pMgr->FindTexture(texname); |
| 752 | if (!pTex) |
| 753 | { |
| 754 | LWARNING("LoadImage: ����ͼ��'%m'ʧ��, ���ҵ�����'%m'", name, texname); |
| 755 | return false; |
| 756 | } |
| 757 | |
| 758 | fcyRefPointer<f2dSprite> pSprite; |
| 759 | fcyRect tRect((float)x, (float)y, (float)(x + w), (float)(y + h)); |
| 760 | if (FCYFAILED(LAPP.GetRenderer()->CreateSprite2D(pTex->GetTexture(), tRect, &pSprite))) |
| 761 | { |
| 762 | LERROR("LoadImage: ��������'%m'����ͼ��'%m' (CreateSprite2D failed)", texname, name); |
| 763 | return false; |
| 764 | } |
| 765 | |
| 766 | try |
| 767 | { |
| 768 | fcyRefPointer<ResSprite> tRes; |
| 769 | tRes.DirectSet(new ResSprite(name, pSprite, a, b, rect)); |
| 770 | m_SpritePool.emplace(name, tRes); |
| 771 | } |
| 772 | catch (const bad_alloc&) |
| 773 | { |
| 774 | LERROR("LoadImage: �ڴ治��"); |
| 775 | return false; |
| 776 | } |
| 777 | |
| 778 | #ifdef LSHOWRESLOADINFO |
| 779 | LINFO("LoadImage: ͼ��'%m'��װ�� (%s)", name, getResourcePoolTypeName()); |
| 780 | #endif |
| 781 | } |
| 782 | |
| 783 | LDEBUG_RESOURCEHINT(ResourceType::Sprite, L"N/A"); |
| 784 | return true; |
| 785 | } |
| 786 | |
| 787 | bool ResourcePool::LoadAnimation(const char* name, const char* texname, |
| 788 | double x, double y, double w, double h, int n, int m, int intv, double a, double b, bool rect) |
nothing calls this directly
no test coverage detected