Cocos2d-x 3.4 学习
文章平均质量分 65
流冰8095
只要你知道去哪,全世界都会为你让步!
展开
-
Billboard的使用及加动作Animation
BillBoard的使用 auto root = Sprite3D::create(); root ->setNormalizedPosition(Vec2(.5,.25)); addChild(root);BillBoard / Spawn / Sequence 的使用 auto mode1 = Sprite3D::create("Sprite3DTest/orc原创 2015-04-18 12:50:42 · 1955 阅读 · 0 评论 -
cocos2d-x CheckBox的使用
cocos2d::ui::Text* _displayText; void selectedEvent(Ref* pSender, cocos2d::ui::CheckBox::EventType type);Size size = Director::getInstance()->getVisibleSize(); _displayText = cocos2d::ui原创 2016-02-02 00:11:22 · 5572 阅读 · 0 评论 -
Cocos2d-x中ImageView的使用
Size size = Director::getInstance()->getVisibleSize(); ImageView* imageView = ImageView::create("ccicon.png"); imageView->setPosition(Vec2(size.width /2,size.height /2)); imageView->ignoreCo原创 2016-02-02 23:49:11 · 9574 阅读 · 0 评论 -
Cocos2d-x LoadingBar的使用,及定时加载进度
void HelloWorld::update(float delta); int _count = 0;Size size = Director::getInstance()->getVisibleSize(); cocos2d::ui::LoadingBar* loadingBar = cocos2d::ui::LoadingBar::create("sliderP原创 2016-02-03 00:42:56 · 4448 阅读 · 0 评论 -
Cocos2d-x TextAtlas的使用
TextAtlas* textAtlas = TextAtlas::create("1234567890111", "labelatlas.png", 17, 22, "0"); textAtlas->setPosition(Vec2(size.width / 2,size.height /2)); this->addChild(textAtlas);原创 2016-02-03 22:18:53 · 5225 阅读 · 0 评论 -
Cocos2d-x Text的使用
Size size = Director::getInstance()->getVisibleSize(); cocos2d::ui::Text* text = cocos2d::ui::Text::create("TextArea Widget can line wrap", "AmericanTypewriter", 32); text->ignoreContentAdaptW原创 2016-02-03 22:56:12 · 3262 阅读 · 0 评论 -
Cocos2d-x TextBMFont的使用
Size size = Director::getInstance()->getVisibleSize(); cocos2d::ui::TextBMFont* textBMFont = cocos2d::ui::TextBMFont::create("BMFont", "bitmapFontTest2.fnt"); textBMFont->setPosition(Vec2(size原创 2016-02-03 23:27:30 · 3141 阅读 · 0 评论 -
Cocos2d-x TextField的使用
void textFieldEvent(Ref *pSender, cocos2d::ui::TextField::EventType type);cocos2d::ui::Text* _displayValueLabel;Size size = Director::getInstance()->getVisibleSize();_displayValueLabel = co原创 2016-02-03 23:54:16 · 9696 阅读 · 0 评论 -
Cocos2d-x Layout使用
Size size = Director::getInstance()->getVisibleSize();Layout* layout = Layout::create();layout->setContentSize(Size(300,200));layout->setBackGroundColorType(LAYOUT_COLOR_SOLID);//layout->setSi原创 2016-02-18 21:49:28 · 2448 阅读 · 0 评论 -
Cocos2d-x Layout的使用二
Size size = Director::getInstance()->getVisibleSize();Layout* root = Layout::create();root->setContentSize(Size(500,400));root->setLayoutType(LayoutType::ABSOLUTE);root->setPosition(Vec2(size.原创 2016-02-18 22:25:02 · 1666 阅读 · 0 评论 -
Cocos2d-x Layout使用三
Layout* layout = Layout::create();layout->setLayoutType(LayoutType::RELATIVE);layout->setContentSize(Size(600, 550));layout->setAnchorPoint(Point(0.5f,0.5f));layout->setBackGroundColorType(Lay原创 2016-02-18 22:36:52 · 2875 阅读 · 0 评论 -
Cocos2d-x LayoutComponent的使用
void touchEvent(Ref *pSender, cocos2d::ui::Widget::TouchEventType type);cocos2d::LayerColor* _baseLayer;void HelloWorld::init2();---------------------------------------------------------------原创 2016-02-18 23:18:08 · 3260 阅读 · 0 评论 -
Cocos2d-x ListView 的添加,删除,点击和滑动到头和尾监听
void selectedItemEvent(Ref* pSender, cocos2d::ui::ListView::EventType type);//头文件中声明两个函数void selectedItemEventScrollView(Ref* pSender, cocos2d::ui::ScrollView::EventType type);----------------原创 2016-02-20 21:36:41 · 6755 阅读 · 0 评论 -
Cocos2d-x PageView的使用
void pageViewEvent(Ref* pSender, cocos2d::ui::PageView::EventType type);--------------------------------------------------------------------------------------------------------------------------原创 2016-02-21 12:29:38 · 2241 阅读 · 0 评论 -
cocos2d-x Button的监听使用
virtual bool init(); void touchEvent(Ref *pSender, cocos2d::ui::Widget::TouchEventType type,int tt);Size wsize = Director::getInstance()->getVisibleSize(); _displayValueLabel = cocos2d::ui::原创 2016-01-31 01:52:53 · 2526 阅读 · 0 评论 -
cocos2d-x 创建精灵的五种方法
cocos2d-x游戏开发5中创建精灵方法:方法一:直接创建精灵 适合于要显示的是这张图片的全部区域, 1CCSprite * sprite = CCSprite::create("Icon.png");上面那句话也可以根据需要这样来写:12345原创 2016-01-31 00:40:37 · 1227 阅读 · 0 评论 -
Cocos2d-x 3.4 Action管理(ActionManager)总结
Cocos2d-x Action管理动作管理类CCActionManager是一个管理所有动作的单例,工作原理是:当CCNode执行runAction时,该函数会把动作通过动作管理类的addAction函数将对象传递给CCActionManager的单例,该实例再把这个动作添加到自己的动作序列中。动作管理单例通过定时刷新自己的update方法,在这个方法中去调用行为序列中每个动作的原创 2015-04-12 22:54:50 · 3501 阅读 · 0 评论 -
Cocos2d-x 3.4 进度条总结
Cocos2d-x 3.4进度条 旋转进度条auto s =Director::getInstance()->getWinSize();auto to1 =Sequence::createWithTwoActions(ProgressTo::create(2,100),ProgressTo::create(0,0));//旋转进度条a原创 2015-04-12 12:56:58 · 978 阅读 · 0 评论 -
ClippingNode的使用
ClippingNode(裁剪节点)可以用来对节点进行裁剪,可以根据一个模板切割图片的节点,生成任何形状的节点显示。ClippingNode是Node的子类,可以像普通节点一样放入Layer,Scene,Node中。ClippingNode 原理:ClippingNode是利用模板遮罩来完成对Node区域裁剪的技术。如何理解ClippingNode的原创 2015-04-23 22:49:09 · 947 阅读 · 0 评论 -
ClippingNode 实现类似子弹打穿纸片效果
auto target = Sprite::create("Images/blocks.png"); target->setAnchorPoint(Vec2::ZERO); target->setScale(3); _outerClipper = ClippingNode::create(); _outerClipper->retain(); AffineTransfo原创 2015-04-24 00:00:48 · 1110 阅读 · 0 评论 -
创建3D模型/添加屏幕监听,点击屏幕时,精灵带有旋转的移动
3D模型创建 //3D models auto model = Sprite3D::create("Sprite3DTest/boss1.obj"); model->setScale(4); model->setTexture("Sprite3DTest/boss.png"); model->s原创 2015-04-20 16:09:23 · 1397 阅读 · 0 评论 -
Cocos2d-x 各个动作含义
MoveBy/MoveTo: 创建一个移动的动作EaseIn/EaseOut: 动作由慢变快/动作由快变慢EaseInOut:动作由慢变快再由快变慢EaseExponentialIn:动作由慢变极快EaseExponentialOut:动作由极快变慢EaseExponentialInOut:动作由慢至极快再由极快边慢EaseSineIn:动作由快变慢Ea原创 2015-04-09 23:00:01 · 827 阅读 · 0 评论 -
Cocos2d-x 原生EditBox三种形式的使用
包含头文件#include "ui\CocosGUI.h"#include "cocos-ext.h"USING_NS_CC;USING_NS_CC_EXT;using namespace ui;auto glview = Director::getInstance()->getOpenGLView(); auto visibleOrigin = glv原创 2016-01-27 23:43:39 · 2421 阅读 · 0 评论 -
Cocos2d-x EditBox 带有监听功能
TestEditBox2.h#include "cocos2d.h"#include "ui/CocosGUI.h"#include "extensions/cocos-ext.h"USING_NS_CC;using namespace ui;class TestEditBox2 : public Layout, public cocos2d::extension::Edi原创 2016-01-28 21:44:04 · 1913 阅读 · 0 评论 -
Cocos2d-x 布局Layout , VBox,HBox可以互相嵌套
Size winSize = Director::getInstance()->getVisibleSize(); Layout* _verticalLayout = cocos2d::ui::VBox::create();//水平布局 _verticalLayout->setPosition(Vec2(winSize.width / 2 - 80,winSize.height -原创 2016-01-28 23:15:26 · 2015 阅读 · 0 评论 -
九宫格CCScale9Sprite的使用
auto glview = Director::getInstance()->getOpenGLView(); auto visibleOrigin = glview->getVisibleOrigin(); auto visibleSize = glview->getVisibleSize(); Size size = Director::getInstance()->getVisi原创 2016-01-30 22:40:59 · 1012 阅读 · 0 评论 -
九宫格CCScale9Sprite的使用二
auto wSize = Director::getInstance()->getOpenGLView(); auto moveTo = MoveBy::create(1.0f,Vec2(30,0)); auto moveBack = moveTo->reverse(); auto ratateBy = RotateBy::create(1.0f,180); auto fa原创 2016-01-30 23:08:14 · 1806 阅读 · 0 评论 -
Cocos2d-x 用lambda表达式实现监听,改变精灵的透明度和层级
Vec2 origin = Director::getInstance()->getVisibleOrigin(); Size size = Director::getInstance()->getVisibleSize(); auto containerForSprite1 = Node::create(); auto sprite1 = cocos2d::ui::Scale原创 2016-01-31 00:22:33 · 1288 阅读 · 0 评论 -
SpriteFrameCache精灵框使用
SpriteFrameCache *frameCache = SpriteFrameCache::getInstance();frameCache->addSpriteFramesWithFile("boy.plist","boy.png");//boy.png里集合了boy1.png,boy2.png这些小图auto frame_sp = Sprite::createWi原创 2016-01-31 00:33:45 · 1974 阅读 · 0 评论 -
Cocos2d-x ScrollView使用
Size size = Director::getInstance()->getVisibleSize();cocos2d::ui::ScrollView* sView = cocos2d::ui::ScrollView::create();sView->setContentSize(Size(500,400));//sView->setDirection(ui::ScrollView原创 2016-02-21 21:39:08 · 2382 阅读 · 0 评论