【文件属性】:
文件名称:HttpClient动态加载网络图片
文件大小:3KB
文件格式:ZIP
更新时间:2021-06-28 13:44:19
cocos2d
//加载一个网络图片
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
CoaSingleton::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__
【文件预览】:
WebSprite.h
WebSprite.cpp