newlist

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

随笔分类 -  cocos2d-x

1 2 3 4 5 6 下一页

只有注册用户登录后才能阅读该文。
posted @ 2020-01-02 22:40 一枚程序 编辑

摘要:#include "HelloWorldScene.h"//物理引擎标识 int ball1Mask = 1 getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL); // 'layer' is an au... 阅读全文
posted @ 2015-03-24 17:34 一枚程序 阅读(592) 评论(0) 推荐(0) 编辑

摘要:#define RAND_LIMIT 32767/// Random number in range [-1,1]inline float32 RandomFloat(){ float32 r = (float32)(std::rand() & (RAND_LIMIT)); ... 阅读全文
posted @ 2015-03-19 14:03 一枚程序 阅读(719) 评论(0) 推荐(0) 编辑

摘要:class EnemyBase : public Sprite { public: virtual bool init() override; CREATE_FUNC(EnemyBase); Animation* createAnimation(std::s... 阅读全文
posted @ 2014-11-27 21:51 一枚程序 阅读(256) 评论(0) 推荐(0) 编辑

摘要://让精灵动起来,并改变方向void EnemyBase::changeDirection(float dt) { auto curr = currPoint(); if(curr->getPositionX() > this->getPosition().x ) {... 阅读全文
posted @ 2014-11-27 15:54 一枚程序 阅读(209) 评论(0) 推荐(0) 编辑

摘要://给精灵创建帧动画Animation* EnemyBase::createAnimation(std::string prefixName, int framesNum, float delay) { // 1 Vector animFrames; // 2 fo... 阅读全文
posted @ 2014-11-27 15:10 一枚程序 阅读(427) 评论(0) 推荐(0) 编辑

摘要:function UIBagController:initItemView( ) -- 获取面板 self.panelCenter = tolua.cast(UIHelper:seekWidgetByName(self.owner, "Panel_Center"), "Layout");... 阅读全文
posted @ 2014-04-15 19:46 一枚程序 阅读(1568) 评论(0) 推荐(0) 编辑

摘要:--local MainSceneConfig = require "res.scripts.configs.MainSceneConfig" -- 暂时添加一个临时配置文件--require "res.scripts.scenes.MainScene"-- 加载事件OnLoadingStart = "OnLoadingStart";OnLoadingProcess = "OnLoadingProcess";OnLoadingEnd = "OnLoadingEnd";-- 加载类型SOUNDTY 阅读全文
posted @ 2014-04-05 22:36 一枚程序 阅读(1345) 评论(1) 推荐(0) 编辑

摘要:CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfoAsync("armature/robot.png", "armature/robot.plist", "armature/robot.xml", this, NULL);CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfoAsync("armature/hero.ExportJson 阅读全文
posted @ 2014-03-18 16:07 一枚程序 阅读(1643) 评论(0) 推荐(0) 编辑

摘要:CCSprite* pImgBg = CCSprite::create("1.png"); pImgBg->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width / 2, CCDirector::sharedDirector()->getWinSize().height / 2)); this->addChild(pImgBg); CCActionInterval *action = CCShatteredTiles3D::create(0.2f, CCSizeMake(16 阅读全文
posted @ 2014-03-17 11:18 一枚程序 阅读(335) 评论(0) 推荐(0) 编辑

摘要:#include "Common.h"#ifdef WIN32#include #else#include #include #endif#include "iconvstring/IconvString.h"#include "iconvstring/IconvStringEx.h"USING_NS_CC;namespace{ int MonthWeekDay [10][12][1] = { // 2013 { {0}, {0}, {0}, {0}, {0}, {0}, {1}, {4}, {7}, {2}, {5}, {7} .. 阅读全文
posted @ 2014-02-26 10:55 一枚程序 阅读(240) 评论(0) 推荐(0) 编辑

摘要:// 创建cat精灵 CCSprite* cat = CCSprite::create("Image\\grossini.png"); //change the transform anchor point to 0,0 (optional) cat->setAnchorPoint( ccp(0,0) ); //创建 background 精灵最为背景 CCSprite* background = CCSprite::create("Image\\background.png"); // scale the image (optional) bac 阅读全文
posted @ 2014-02-23 23:57 一枚程序 阅读(1134) 评论(0) 推荐(0) 编辑

摘要:CCArmatureDataManager::sharedArmatureDataManager()-> addArmatureFileInfo("armature\\Cowboy0.png", "armature\\Cowboy0.plist", "armature\\Cowboy.ExportJson"); for (int i = 0; i getAnimation()->playWithIndex(0); armature->setPosition(ccp(CCDirector::sharedDirector 阅读全文
posted @ 2014-02-21 10:39 一枚程序 阅读(796) 评论(0) 推荐(0) 编辑

摘要:这个例子主要是用cocos2d-x引擎自带的资源cocos2d-x-2.2.2\samples\Cpp\TestCpp\Resources\armature新建工程之后#include "HelloWorldScene.h"#include "cocos-ext.h"USING_NS_CC;USING_NS_CC_EXT;CCScene* HelloWorld::scene(){ // 'scene' is an autorelease object CCScene *scene = CCScene::create(); // ' 阅读全文
posted @ 2014-02-20 14:34 一枚程序 阅读(335) 评论(0) 推荐(0) 编辑

摘要:CCRenderTexture,它允许你来动态创建纹理,并且可以在游戏中重用这些纹理。 使用CCRenderTexture非常简单 – 你只需要做以下5步就行了:创建一个新的CCRenderTexture. 这里,你可以指定将要创建的纹理的宽度和高度。.调用CCRenderTexture:begin. 这个方法会启动OpenGL,并且接下来,任何绘图的命令都会渲染到CCRenderTexture里面去,而不是画到屏幕上。绘制纹理. 你可以使用原始的OpenGL调用来绘图,或者你也可以使用cocos2d对象里面已经定义好的visit方法。(这个visit方法就会调用一些opengl命令来绘制c. 阅读全文
posted @ 2014-02-17 11:17 一枚程序 阅读(10741) 评论(0) 推荐(1) 编辑

摘要:/** * CCDictionary is a class like NSDictionary in Obj-C . * * @note Only the pointer of CCObject or its subclass can be inserted to CCDictionary. * @code * // Create a dictionary, return an autorelease object. * CCDictionary* pDict = CCDictionary::create(); * * // Insert objects to dictionary... 阅读全文
posted @ 2014-02-03 21:31 一枚程序 阅读(754) 评论(0) 推荐(0) 编辑

摘要:CCScale9Sprite* pBGPicFrame = CCScale9Sprite::create((g_ImgPath + "23.png").c_str()); CC_ERROR(pBGPicFrame, "【CActiveSetInfoLayer::ShowRight】pBGPicFrame is null !"); pBGPicFrame->setContentSize(CCSizeMake(280, 779)); pBGPicFrame->setAnchorPoint(ccp(0, 0)); pBGPicFrame->s 阅读全文
posted @ 2014-01-25 14:59 一枚程序 阅读(325) 评论(0) 推荐(0) 编辑

摘要://-----------------------------------------------------------------//@file gameui/Module/MdGraySprite.h//@date 2013-11-07//@desc 精灵灰化:shader//@action UI组件//-----------------------------------------------------------------#ifndef __GAMEUI_MODULE_MDGRAYSPRITE_H__#define __GAMEU... 阅读全文
posted @ 2014-01-24 19:30 一枚程序 阅读(561) 评论(0) 推荐(0) 编辑

摘要:#ifndef __FIGTH_H__#define __FIGTH_H__#include "cocos-ext.h"#include "include/ILayer.h"#include "kernel/BaseDefine.h"USING_NS_CC;USING_NS_CC_EXT;class CFigthLayer : public CBaseLayer{private: enum E_FIGHT { FIGHT_NIL = 0, FIGHT_NORTH = 4, // 北 FIGH... 阅读全文
posted @ 2014-01-24 19:28 一枚程序 阅读(567) 评论(0) 推荐(0) 编辑

摘要:virtual void registerWithTouchDispatcher(void); virtual bool ccTouchBegan(CCTouch *pTouch,CCEvent *pEvent); virtual void ccTouchMoved(CCTouch *pTouch,CCEvent *pEvent); virtual void ... 阅读全文
posted @ 2014-01-04 13:52 一枚程序 阅读(579) 评论(0) 推荐(0) 编辑

1 2 3 4 5 6 下一页