摘要:MapInfo* CGameConfig::getMapInfoById( int nId ){ for (map::iterator it = m_mapMapInfo.begin(); it != m_mapMapInfo.end(); it++) { if (nId == it->first) { return &(it->second); } } CCLog("error: CGameConfig::getMapInfoById"); return NULL;}
阅读全文
随笔分类 - C++
摘要:"100,100;500,500;300,300;150,150;30,30"static void split(const string& src, const string& separator, vector& dest) { string str = src; string substring; string::size_type start = 0, index; do { index = str.find_first_of(separator,start); if...
阅读全文
摘要:// libxmlTest.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include int _tmain(int argc, _TCHAR* argv[]){ //定义文档和节点指针 xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); xmlNodePtr root_node = xmlNewNode(NULL,BAD_CAST"root"); //设置根节点 xmlDocSetRootElement(d
阅读全文
摘要:打开然后将图片拖入点击回到项目中,添加现有项,得到CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("spriteframe.plist"); CCSpriteFrame* pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("12.png"); CCSprite *pSprite = CCSprite::spriteWithSpriteFrame(pFrame
阅读全文
摘要:#ifndef HROCKER_H#define HROCKER_H#include "cocos2d.h"using namespace cocos2d;//用于标识摇杆与摇杆的背景typedef enum{ tag_rocker, tag_rockerBG,}tagForHRocker;class HRocker:public CCLayer{public: HRocker(void); ~HRocker(void); //创建摇杆(摇杆的操作题图片资源名,摇杆背景图片资源名,起始坐标) static HRocker* createHRocker...
阅读全文
摘要://自定义粒子 CCParticleSystem* myParticle = CCParticleSystemQuad::create("Flower.plist"); addChild(myParticle);
阅读全文
摘要:CCParticleSystem* particleSystemFree = CCParticleSun::create(); //设置贴图 particleSystemFree->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png")); //设置自动释放 particleSystemFree->setAutoRemoveOnFinish(true); //设置类型移动类型kCCPositionTypeFree-----随着layer的移...
阅读全文
摘要:1 //爆炸粒子效果 2 CCParticleSystem* particleSystem = CCParticleExplosion::create(); 3 particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("stars.png")); 4 this->addChild(particleSystem); 5 6 //火焰粒子效果 7 CCParticleSystem* particleSystem = CCPa...
阅读全文
摘要:1 #ifndef BASE_DATA 2 #include 3 4 class BaseData 5 { 6 public: 7 BaseData(void); 8 ~BaseData(void); 9 10 std::string saveData(char const* bytes_to_encode,unsigned int in_len);11 std::string parseData(std::string const& encoded_string);12 13 };14 15 #endif 1 #include "BaseData.h...
阅读全文

浙公网安备 33010602011771号