cocos2dxHellowoed 发现 2.2.3

cocos2d	笔记
	文件夹介绍
		cocosdx ----->cocos2d主要代码
		CocosDenshion---->cocos2d的声音的
		Document------>文档
		extensions ---->cocos2d一些拓展
		projects ----->一些project
		samples------>cocos2d的一些提供的案例
		scripting ----->脚本
		template ------>模板
		tools   ------->工具
	project介绍
		Classes ----->是夸平台的代码
		Resources ---->资源(声音,脚本)
		proj. ----->是不能够跨平台的代码
	主要參数
		CCEGLView* eglView = CCEGLView::sharedOpenGLView();
    eglView->setViewName("名字");
    eglView->setFrameSize(长, 宽);//主要是界面
 		------------------------------------------------------------------------------

    bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);//使pEGLView和pDirector关联,通过setOpenGLView进行关联

    // turn on display FPS
    pDirector->setDisplayStats(true);//是左下角的显示的fps一般分布会关闭

    // set FPS. the default value is 1.0/60 if you don‘t call this
    pDirector->setAnimationInterval(1.0 / 60);//每针多少秒

    // create a scene. it‘s an autorelease object
    CCScene *pScene = HelloWorld::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
	CCScene* HelloWorld::scene(){
	    // ‘scene‘ is an autorelease object
	    CCScene *scene = CCScene::create();//创建一个scene

	    // ‘layer‘ is an autorelease object
	    HelloWorld *layer = HelloWorld::create();//创建一个城

	    // add layer as a child to scene
	    scene->addChild(layer);//把scene加入到城

	    // return the scene
	    return scene;//在返回scene
	}

	bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )//调用父类的init
    {
        return false;
    }

    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it‘s an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "CloseNormal.png",
                                        "CloseSelected.png",
                                        this,
                                        menu_selector(HelloWorld::menuCloseCallback));//创建那个button

	pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
                                origin.y + pCloseItem->getContentSize().height/2));

    // create menu, it‘s an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition(CCPointZero);
    this->addChild(pMenu, 1);

    /////////////////////////////
    // 3. add your codes below...

    // add a label shows "Hello World"
    // create and initialize a label

    CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24);

    // position the label on the center of the screen
    pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
                            origin.y + visibleSize.height - pLabel->getContentSize().height));

    // add the label as a child to this layer
    this->addChild(pLabel, 1);

    // add "HelloWorld" splash screen"
    CCSprite* pSprite = CCSprite::create("HelloWorld.png");

    // position the sprite on the center of the screen
    pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    // add the sprite as a child to this layer
    this->addChild(pSprite, 0);

    return true;
}

	CCDirector 导演
		 设置全局属性。推动剧情发展,单例对象
			 CCDirector* director = CCDirector::sharedDirector();
	CCScene	是场景的意思
			游戏有多个场景构成。可是某一时刻仅仅有一个场景在执行
			CCScene是一个独立的工作流,场景类在cocos里,一般仅仅作为容器。装载其它游戏元素
	CCLayer    层类
   		归类
  	 	处理触摸消息
   		CCColorLayer(颜色), CCMenu
	CCSprite 精灵类
			 抽象游戏角色(主角。敌人,道具。。

。

。。)体现游戏外观(包括了纹理),通过改动属性来改变精灵的位置、颜色、。

。

。。,或者是执行动作让精灵变得生动

	CCNode 渲染树的节点类,全部可渲染对象都从CCNode派生

	using namespace cocos2d; ==	USING_NS_CC; 一般用后面的

	// 实现create的静态函数,create函数会自己主动调用init函数
	CREATE_FUNC(MyLayer);

	第一个scene 用runWithScene
 	pDirector->runWithScene(pScene);

 	以后scene 用replaceScene
 	CCDirector::sharedDirector()->replaceScene(MyLayer::scene());

 	setTouchEnabled(true);
 	支持触摸 假设不写不赞成触摸
 	setTouchMode(kCCTouchesAllAtOnce);
 	多点触摸:比方双手按在手机屏幕什么
 	setTouchMode(kCCTouchesOneByOne)。
  单点触摸:比方单手按在手机屏幕什么

 bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);//当你手指刚刚按下是时候
void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);//当你手指移动按下是时候
void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);//当你手指离开按下是时候
void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);//当你电话来的时候	

 	CCPoint pt = pTouch->getDelta();//返回的距离
	CCPoint pos = _lable->getPosition();//获取_lable的位置
	_lable->setPosition(ccpAdd(pos,pt));//改变_lable的位置
时间: 2024-08-26 02:49:18

cocos2dxHellowoed 发现 2.2.3的相关文章

FreakZ学习笔记:路由发现机制

路由发现机制 路由发现机制只有在发送通信包的过程中会被调用,而接收过程因为发送时候已经进行了通信链路的扫描和连接,所以不会再进行路由发现机制. 路由的所有处理机制都是在NWK层进行的,当然,路由发现机制也一样.当协议栈进行数据发送时,会依次按照APP->APS->NWK->MAC->PHY->Radio的层次关系来进行,APS层执行完成之后,会跳转到NWK层的nwk_data_req函数,该函数为NWK数据请求服务,接收APS层的数据并且加上NWK层的包头,然后将数据打包.n

Spring Cloud官方文档中文版-服务发现:Eureka服务端

官方文档地址为:http://cloud.spring.io/spring-cloud-static/Dalston.SR3/#spring-cloud-eureka-server 文中例子我做了一些测试在:http://git.oschina.net/dreamingodd/spring-cloud-preparation Service Discovery: Eureka Server 服务发现:Eureka服务端 How to Include Eureka Server 如何创建Eurek

如何让X5发现你的手机

1. 手机开启 USB 调试.不用 ROOT.2. 装驱动.(问题就在这里) 首先要装对驱动,如果你的驱动叫 MyHTC,请立即删除. 找个 手机助手.例如 百度 腾讯 360 等等.反正不论你是谁的水军,都有一款适合你. 只是 腾讯的助手 干扰能力比较强. 手机助手会帮你装驱动.请安装最新版的助手. 正确的驱动名是:Andriod ADB Interface个别手机的驱动可能不是这个名称.下面这个地址有好多驱动下载.http://developer.android.com/tools/extr

zabbix专题:第九章 zabbix自动发现功能详解

zabbix自动发现功能详解 对Linux有兴趣的朋友加入QQ群:476794643 在线交流 本文防盗链:http://zhang789.blog.51cto.co zabbix自动发现功能详解 网络发现简介 有100台服务器,不想一台台主机去添加,能不能让zabbix自动添加主机呢,当然可以,网络发现便是这个功能,当然前提条件是所有服务器都已经安装了agent或者snmp(其实也可以不用,鉴于我们大部分功能都用agent,所以请安装上agent),server扫描配置好的ip段,自动添加ho

小白日记8:kali渗透测试之主动信息收集(二)三层发现:ping、traceroute、scapy、nmap、fping、Hping

三层发现 三层协议有:IP以及ICMP协议(internet管理协议).icmp的作用是用来实现intenet管理的,进行路径的发现,网路通信情况,或者目标主机的状态:在三层发现中主要使用icmp协议,arp协议属于二层协议,它是基于广播的,所以不可路由.而ICMP协议是可以路由的,理论上可以使用icmp协议发现全球的ip,如果没有边界防火墙(禁止icmp的探测包)进行过滤的话,对目标主机进行扫描,则会收到相应的响应,从而进行捕捉[有边界防火墙的现象比较普遍],但是三层发现的扫描速度也较二层要慢

zabbix自动发现监控mongo

1: zabbix自动发现mongo监控的端口,并返回zabbix_server需要的格式,脚本部署在zabbix_agent上,路径为/usr/local/zabbix/zabbix_discover_mongo.sh,脚本内容如下: #!/bin/sh #zhuangweihong 20160419 zabbix discover mysql res=`sudo ss -tulnp|grep mongo|grep -v 28107|awk '{print $(NF-2)}'|awk -F':

哎呀,发现自己不会用模块的方式用kprobe啊,弱爆了

一直以来,用kprobe比较多的是kprobe event的用法,之前用过模块的方式编译过kprobe,但是感觉比较麻烦啊 今天要看看怎么用模块的方法简单编译kprobe: 如何单独编译内核模块 http://blog.sina.com.cn/s/blog_9011bd8c01015ms7.html 这个说得还是比较清楚,但是有几个东西还是不清楚呢,比如make设置了源码的目录,那么内核里面的数据结构他是怎么知道的呢? 1 obj-m := kprobe_example.o 2 obj-m +=

Nginx日志内发现大量恶意ip自动加入防火墙脚本

#!/bin/bash #_日志位置 _log_Path="/data0/nginx/weblogs/" #_日志文件名称 _log_FileName="access_blog.kinggoo.com.log" #_要被屏蔽的ip访问端口,默认80 _port="80" _nginx_deny="/opt/webserver/nginx/conf/deny.conf" _nginx_bin="/opt/webserv

递归和循环---从EasyUI Tree 发现自己的硬伤

前一阵子,朋友托我帮忙用vb.net写一个数独游戏,我当时的第一个想法---万能的互联网肯定有资源,肯定有人写---当然这是必须的---我站在巨人的肩膀上帮朋友完成代码---但是我突然觉得自己站在巨人这么高的肩膀上太高耸,想要找一下脚踏实地的感觉,所以我想自己写写,看看能不能写出来,结果就是------我压根没有思路. 对,毫不夸张,无从下手. 更深刻的一件事就是项目中用的的树状结构(easyui tree 实现),同样是根据数据库动态生成,我站在巨人的肩膀上,看着网上类似的datatable转