自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

最爱小麻烦

cocos2dx 初学者互勉。

  • 博客(25)
  • 收藏
  • 关注

原创 Lua 语法学习记录一

local n = 4 function fact( n ) -- 求n的阶乘,递归 if n == 0 then return 1 else return n*fact(n-1) end end print(fact(n)) -- 24 print(type(

2014-11-11 16:16:08 583

原创 C++ 之 函数指针

void say(int x, int y){ cout << x << y << endl;}int main(){ void (*func)(int,int); //func = say; //都可以 func = &say; (*func)(1,1); func(1,1); system("pause"); return 0;}

2014-10-11 22:39:26 477

原创 C++ 之 虚函数、多态

一共三个文件 main.cpp     Person.h     Person.cpp

2014-09-15 18:05:19 574

原创 C++ 之 部分容器的使用

#include #include #include #include using namespace std;int main(){ /********* list ********/ list lis; lis.push_back("hello"); lis.push_back("world"); for (auto it = lis.begin(); it!=l

2014-08-11 14:04:49 454

原创 C++ 之 伪函数

#include using namespace std;class Say{public: void operator()(){ //重载()符号 printf("hello ()"); }};int main(){ Say s; s(); //像函数一样调用,其实是一个类 system("pause"); return 0;}

2014-08-11 10:05:33 691

原创 C++ 之 运算符重载

#include using namespace std;class point{private: int a,b;public: point(int a, int b){ //构造方法 this->a = a; this->b = b; } int getA(){ return this->a; } int getB(){ return this->b

2014-08-11 10:01:05 444

原创 C++ 之 虚函数、纯虚函数

#include #include class people{public: void say(){ printf("hello people.\n"); }};class man:public people{public: void say(){ printf("hello man.\n"); }};int main(){ people * p =

2014-08-11 09:33:55 496

原创 Cocos2dx 3.1.1 之 修改屏幕大小

在cocos2dx 2.x版本中,修改屏幕大小的代码在main.cpp中:

2014-08-05 10:06:08 3230

原创 C++ 之 构造函数、析构函数

#include class Object {public: Object(){ //定义构造函数 printf("Create Object. \n"); }; ~Object(){ //定义析构函数 printf("Delete Object. \n"); }};int main(){ Object * o = new Object(); system("

2014-08-04 20:13:32 552

原创 C++ 之 命名空间

当引用多个库,多个ku

2014-08-04 19:47:54 483

原创 C++ 之 对象的实现

people.h#include class People{public: void sayHello(){} People(){}};people.cpp

2014-08-04 19:33:36 486

原创 Cocos2dx 3.1.1 之 在VS2012上配置Box2d

dangwo

2014-08-04 14:23:05 1383

原创 Cocos2dx 3.1.1 之 数据存储

首选项存储:

2014-08-04 10:11:13 1051

原创 Cocos2dx 3.1.1 之 计时器

HelloWorld.h文件部分内容:class HelloWorld : public cocos2d::Layer{private: LabelTTF * label; //定时去移动一个Labelpublic: static cocos2d::Scene* createScene(); virtual bool init(); CREATE_FUNC(

2014-08-04 09:59:13 755

原创 Cocos2dx 3.1.1 之 加速传感器、监听物理按键

//打开加速传感器(默认是关闭的) Device::setAccelerometerEnabled(true); //监听函数 Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(EventListenerAcceleration:: create([](Accele

2014-08-01 09:50:13 852

原创 Cocos2dx 3.1.1 之 多点触碰监听

//多点触碰监听器 auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan = [](std::vector ts, Event *e){ log(" --- onTouchesBegan --- "); }; listener->onTouchesMoved = [](std:

2014-08-01 09:27:57 639

原创 Cocos2dx 3.1.1 之 监听触屏事件

//监听器 auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [](Touch * t, Event * e){ log(" --- onTouchBegan --- "); return true; //return false; //此处返回false,则onTouc

2014-07-31 19:56:59 923

原创 Cocos2dx 3.1.1 之 plist制作动画

////动画,可以用flash来制作plist,导出时候有2.x和3.x的区别 auto cache = SpriteFrameCache::getInstance(); cache->addSpriteFramesWithFile("anim.plist", "anim.png"); //用容器来存放每一帧 Vector vec; char name[15]; memset(nam

2014-07-31 19:20:38 1093 1

原创 Cocos2dx 3.1.1 之 监听器、特效切换场景、动作、检测碰撞、回调函数

auto * sprite = Sprite::create("HelloWorld.png"); sprite->setPosition(200, 200); this->addChild(sprite); LabelTTF * ttf = LabelTTF::create("to next Scene.", "Courier", 20); this->addChild(ttf);

2014-07-31 19:16:08 865

原创 Cocos2d-x 3.1.1 之 MessageBox、LabelTTF、菜单、

if ( !Layer::init() ) { return false; } Size size = Director::getInstance()->getVisibleSize(); //MessageBox("消息内容", "消息标题"); LabelTTF * ttf = LabelTTF::create(); ttf->setSt

2014-07-31 19:11:58 1085

原创 按钮

/* 扣血飘字特效 */ FlowWord* flowWord = FlowWord::create(); this->addChild(flowWord); flowWord->showWord("-15", getSprite()->getPosition());

2014-07-31 19:03:36 545

原创 使用plist创建动画

代码说话: CCSpriteFrameCache* frameCache = CCSpriteFrameCache::sharedSpriteFrameCache(); frameCache->addSpriteFramesWithFile("run.plist", "run.png"); CCSpriteFrame* frame = NULL; CCArray* frameList

2014-07-31 18:47:12 731

原创 使用tmx地图

制作tmx地图可以使用tiled工具。

2014-07-31 17:36:42 1108

原创 创建精灵、执行动作

创建精灵: //图片创建精灵,植物 CCSprite * plant = CCSprite::create("Peashooter1.tiff"); plant->setPosition(ccp(300, 300)); //帧创建精灵步骤1 CCSpriteFrame * frame = CCSpriteFrame::create("Peashooter1.tiff", CCRe

2014-07-31 17:25:08 592

原创 cocos2d-x 3.1.1 在vs2012上新建工程

本文章参考了:IT_xiao小巫 的 http://blog.csdn.net/wwj_748/article/details/24812277

2014-07-13 17:58:39 1241

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除