HttpClient动态加载网络图片
//加载一个网络图片 WebSprite* webimg = WebSpriteAgentInst->createWebSprite("hello","url.png"); this->addChild(webimg); webimg->setPosition(visibleSize/2); 可能需要 #ifndef __SINGLETON_H__ #define __SINGLETON_H__ #include "cocos2d.h" template class CoaSingleton { public: static T* getInstance(); static void releaseInstance(); protected: CoaSingleton(void); ~CoaSingleton(void); private: static T* s_pInstance; }; template CoaSin gleton::CoaSingleton(void) { }; template CoaSingleton::~CoaSingleton(void) { }; template inline T* CoaSingleton::getInstance() { if(!s_pInstance) { s_pInstance = new T; } return s_pInstance; } template void CoaSingleton::releaseInstance(){ if(!s_pInstance) { return; } delete s_pInstance; s_pInstance = NULL; } template T* CoaSingleton::s_pInstance = NULL; #endif //__SINGLETON_H__ gleton::CoaSingleton(void) { }; template CoaSingleton::~CoaSingleton(void) { }; template inline T* CoaSingleton::getInstance() { if(!s_pInstance) { s_pInstance = new T; } return s_pInstance; } template void CoaSingleton::releaseInstance(){ if(!s_pInstance) { return; } delete s_pInstance; s_pInstance = NULL; } template T* CoaSingleton::s_pInstance = NULL; #endif //__SINGLETON_H__
用户评论