C++操作SQLite数据库

摘要: 准备工作在使用C++操作SQLite之前,需要获得sqlite3.h,sqlite3.lib,sqlite3.dll,大家可以在这里下载。并将这3个文件导入VC++工程中。其中sqlite3.dll文件放到Debug文件夹里。SQLite API介绍int sqlite3_open(char *path,sqlite3 **db)这个函数打开数据库,第一个参数为sqlite文件的地址,第二个参数是sqlite3的指针的指针,也就是二级指针。返回值为SQLITE_OK则成功打开数据库。 sqlite3_close(sqlite3 *db)这个函数关闭数据库,参数是sqlite3的指针。 sqli 阅读全文
posted @ 2013-04-24 09:31 jack_yan 阅读(782) 评论(0) 推荐(0)

抗锯齿

摘要: CCSprite *s= CCSprite::create("xiao.png"); s->getTexture()->setAntiAliasTexParameters(); s->setPosition(ccp(240, 160)); addChild(s); CCActionInterval *ac = CCScaleTo::create(2, 5); s->runAction(ac); 阅读全文
posted @ 2013-04-24 09:28 jack_yan 阅读(171) 评论(0) 推荐(0)

手指效果

摘要: HelloWorld::HelloWorld(){ smoke=CCParticleSmoke::create(); sun=CCParticleSun::create(); }HelloWorld::~HelloWorld(){ smoke->setAutoRemoveOnFinish(true); sun->setAutoRemoveOnFinish(true);} CCScene* HelloWorld::scene(){ // 'scene' is an autorelease object CCScene *scene = CCScene::cre... 阅读全文
posted @ 2013-04-23 13:29 jack_yan 阅读(249) 评论(0) 推荐(0)

系统自带的粒子系统

摘要: CCParticleSnow *snow=CCParticleSnow::create(); snow->setPosition(ccp(400,670)); snow->setTextureWithRect(CCTextureCache::sharedTextureCache()->addImage("snow.png"),CCRectMake(0,0,32,32)); addChild(snow); 阅读全文
posted @ 2013-04-23 11:59 jack_yan 阅读(183) 评论(0) 推荐(0)

自定义粒子系统

摘要: CCParticleSystemQuad *m_emitter = new CCParticleSystemQuad(); m_emitter->initWithTotalParticles(900);//900个粒子对象 //设置图片 m_emitter->setTexture(CCTextureCache::sharedTextureCache()->addImage("snow1.png")); //设置发射粒子的持续时间-1表示一直发射,0没有意义,其他值表示持续时间 m_emitter->setDuration(-1); //设置中心方向, 阅读全文
posted @ 2013-04-23 11:58 jack_yan 阅读(202) 评论(0) 推荐(0)

技能冷却

摘要: CCSprite *s2 = CCSprite::create("pa1.png"); s2->setPosition(ccp(200,200)); addChild(s2,0); CCSprite *s = CCSprite::create("pa2.png"); CCProgressTimer *pt = CCProgressTimer::create(s); pt->setPosition(200,200); pt->setType(cocos2d::CCProgressTimerType(kCCProgressTimerType 阅读全文
posted @ 2013-04-23 11:34 jack_yan 阅读(176) 评论(0) 推荐(0)

精灵点击移动

摘要: CCSetIterator it = pTouches->begin(); CCTouch *touch = (CCTouch*)(*it); CCPoint m_tBeginPos = touch->getLocationInView(); m_tBeginPos = CCDirector::sharedDirector()->convertToGL(m_tBeginPos); CCAction *moveto = CCMoveTo::create(2, m_tBeginPos); player->runAction(moveto); 阅读全文
posted @ 2013-04-16 21:54 jack_yan 阅读(168) 评论(0) 推荐(0)

cocos2d-x 简单OpenGL 画图

摘要: void testNode::draw(){ CCSize s = CCDirector::sharedDirector()->getWinSize(); //线 glLineWidth( 5.0f ); //线宽 ccDrawColor4B(255,0,0,255);//画笔颜色 ccDrawLine( CCPointMake(0, s.height/2), CCPointMake(s.width, s.height/2) );//画一条线 ccDrawLine( CCPointMake(s.width/2, 0), C... 阅读全文
posted @ 2013-04-14 10:43 jack_yan 阅读(397) 评论(0) 推荐(0)

cocos2d-x tile map瓦片地图的黑线及地图抖动解决方案

摘要: BUG 1:地图的每个图块之间有一些细密的间隔,特别是场景移动时更加明显,将游戏截图放大,可以很明显看到这个细线 解决方案:通过设置ccConfo.h中的CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL宏来解决。 将 #define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 0 改为 #define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 1 ccConfig.h位置:/cocos2dx/include/ccConf... 阅读全文
posted @ 2013-04-14 10:37 jack_yan 阅读(1014) 评论(0) 推荐(0)

在cocos2d-x 2.x FPS 等参数

摘要: // 1.最上面一行是指的当前场景的渲染批次。(简单理解为需要渲染多少个贴图出来)// 2.中间一行是渲染每一帧需要的时间。// 3.最下行就是大家熟悉的FPS。 bool AppDelegate::applicationDidFinishLaunching(){ // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); CCSize scre... 阅读全文
posted @ 2013-04-14 10:37 jack_yan 阅读(440) 评论(0) 推荐(0)