摘要: TCP// TCP_Server.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include #include #pragma comment (lib,"ws2_32.lib")using namespace std;void _tmain(int argc, _TCHAR* argv[]){ WSADATA wsData; //WinSock Async 环境数据 WSAStartup(0x0202, &wsD 阅读全文
posted @ 2013-09-17 22:58 解放1949 阅读(310) 评论(0) 推荐(0)
摘要: void HelloWorld::testCCUserDefault(){ CCSize size = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* ttf = CCLabelTTF::create(" ", "Helvetica", 30); ttf->setPosition(ccp(size.width/2, size.height/2)); addChild(ttf); if (CCUserDefault::sharedUserDefault()->getBoolF 阅读全文
posted @ 2013-09-08 21:24 解放1949 阅读(447) 评论(0) 推荐(0)
摘要: //不使用 CCParticleBatchNode : 注意比较 左下角的显示信息for(int i=0; isetTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png")); particleSystem->setPosition(ccp(150+i*20,160)); addChild(particleSystem);}//使用 CCParticleBatchNode : 注意比较 左下角的显示信息CCTexture2D* texture = CCTextureCache::shar 阅读全文
posted @ 2013-09-03 23:47 解放1949 阅读(1001) 评论(0) 推荐(0)
摘要: 实现类CCSVParse.h#ifndef __C_CSV_PARSE__#define __C_CSV_PARSE__#include "cocos2d.h"#include using namespace std;class CCSVParse{public: //CCSVParse(void); ~CCSVParse(void); CCSVParse(istream& fin=cin, string sep=","): fieldsep(sep), cols(0) { } //用以存储数据 std::vector> d... 阅读全文
posted @ 2013-09-03 00:04 解放1949 阅读(1946) 评论(1) 推荐(0)
摘要: 实现类 CXmlParse啥也不说了 直接上硬货believe yourself 一看就明白CXmlParse.h#ifndef __C_XML_PARSE__#define __C_XML_PARSE__#include "cocos2d.h"using namespace cocos2d;class CXmlParse : public CCObject , public CCSAXDelegator{public: CXmlParse(void); ~CXmlParse(void); static CXmlParse* parseWithFile(const char 阅读全文
posted @ 2013-09-01 21:36 解放1949 阅读(759) 评论(1) 推荐(0)
摘要: #include "stdafx.h"#include using namespace std;class MyString{public: MyString(const char *str = NULL); //通用拷贝构造函数 MyString(const MyString &another... 阅读全文
posted @ 2013-09-01 13:04 解放1949 阅读(409) 评论(0) 推荐(0)
摘要: 第一步:首先弄一个 json 文件 我这里成为 config.json 内容如下{ "1000": { "id":1000, "desc":"中华人民共和国" }, "1001": { "id":1001, "desc":"中国人民银行" }}第二步:添加解析 json 文件的函数 记得 首先声明一个全局的 map 容器 或者成员的 map 容器 map_ForTextint HelloWorld::parse_json(){ unsi 阅读全文
posted @ 2013-08-26 22:31 解放1949 阅读(527) 评论(0) 推荐(0)
摘要: 主要用于创建对象。新添加类时,不会影响以前的系统代码。核心思想是用一个工厂来根据输入的条件产生不同的类,然后根据不同类的virtual函数得到不同的结果。advantage:适用于不同情况创建不同的类时disadvantage:客户端必须要知道基类和工厂类,耦合性差#ifndef __SIMPLE_FACTORY_MODEL__#define __SIMPLE_FACTORY_MODEL__//运算类class Operation{public: virtual double getResult() = 0;public: double numberA; double num... 阅读全文
posted @ 2013-08-25 22:46 解放1949 阅读(133) 评论(0) 推荐(0)
摘要: 转自:http://www.cnblogs.com/mrblue/p/3141456.html//array#include void Foo1(){ array a; generate(a.begin(), a.end(), rand); sort(a.begin(), a.end()); for (auto n:a) { coutvoid Foo2(){ if( regex_match("Hello World!", regex("Hello World!")) ) { coutvoid Foo3(){ threa... 阅读全文
posted @ 2013-08-24 18:04 解放1949 阅读(277) 评论(0) 推荐(0)
摘要: 3.27 精灵集合类(CCSpriteBatchNode)//以纹理来创建一个精灵集合对象static CCSpriteBatchNode* createWithTexture(CCTexture2D *tex, unsigned int capacity);//以图片文件来创建一个精灵集合对象static CCSpriteBatchNode* create(const char *fileImage, unsigned int capacity);3.2.8 精灵缓冲帧 (CCSpriteFrameCache)CCSpriteFrame//精灵帧类的属性 CCPoint m_obOff... 阅读全文
posted @ 2013-08-21 23:45 解放1949 阅读(457) 评论(0) 推荐(0)