day01 정령 분석

3811 단어 배우다
day01  
	using namespace cocos2d; ==	USING_NS_CC;       
	
	#ifndef __MYLAYER_H__
	#define __MYLAYER_H__
	---------------          
	 : public CCLayer          CCLayer
	 	
	 	
	CCLayer::init();
	CCLabelTTF *plabel = CCLabelTTF::create("sunda","Arial",36);//    lable
	addChild(plabel,1);// scene      lable
	CCSize size =CCDirector::sharedDirector()->getWinSize();//      
	plabel->setPosition(ccp(size.width / 2,size.height / 2));//  lable       
	//      image CCMenuItemImage::create("CloseNormal.png","CloseSelected.png",this,menu_selector(mylist::menuCloseCallback));
	//           ;
	//           ;
	//                  ;
	CCMenuItemImage *inage = CCMenuItemImage::create("CloseNormal.png","CloseSelected.png",this,menu_selector(mylist::menuCloseCallback));
	CCMenu* pMenu = CCMenu::create(inage, NULL);
	pMenu->setPosition(460,20);//     
	addChild(pMenu, 1);//  

	//      
	CCSprite* pSprite = CCSprite::create("HelloWorld.png");//      
	pSprite->setPosition(ccp(size.width/2 ,size.height/2));//       
	addChild(pSprite,0);//    
	return true;
	
	
	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);//        	
 	
 	    
 	CCSprite* sprite = CCSprite::create("1/furnace/jt.png");
 		       
	CCSprite* sprite = CCSprite::create("1/furnace/jt.png",CCRectMake(0,0,20,20));
		//                  CCRectMake(x   ,y   ,x   ,y   )
	addChild(sprite); 
	CCSize size = CCDirector::sharedDirector()->getWinSize();//       
	sprite->setPosition(ccp(size.width/2,size.height/2));//        
	
	//    
	CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addImage("1/furnace/jt.png");
		//       ,        ,       
	CCSprite* sprite = CCSprite::createWithTexture(texture);
		//            ,      
	CCSprite* sprite = CCSprite::createWithTexture(texture,CCRectMake(0,0,20,20));
 		//                  CCRectMake(x   ,y   ,x   ,y   )
 	
 	CCSpriteFrame* frame = CCSpriteFrame::createWithTexture(texture,CCRectMake(0,0,100,100));
 		//         
 		
 	CCSprite* sprite = CCSprite::create("Images/blocks.png");
 		//            Images/blocks.png
	addChild(sprite);
	sprite->setPosition(ccp(100,100));//      ,       
	
	//    
	sprite->setAnchorPoint(ccp(0,0));
	//1、        (0.5,0.5) 		       ,     
	//0,0     
	//1,1     

	//    
	sprite->setScale(1.5f);
	//      	  	
 		
 	sprite->setScaleX(0.5f);
 	//X    
 	sprite->setScaleY(0.5f);
 	//Y    
 	
 	//    
 	sprite->setRotation(90.f);	
 	        
 	        
 	sprite->setRotationX(90.f);
 	Y    90.     
 	sprite->setRotationY(90.f);
 	Y    90.     
 	
 	//    
	sprite->setSkewX(60.0f);
	X    60       90    
	sprite->setSkewY(60.0f);
	Y    60       90    
 	
 	        
 	   180      180 
 	     ,      
 	
 	//  
	sprite->setFlipX(true);
	 x    
	sprite->setFlipY(true);
	 Y    
 		
 	//  
	sprite->setOpacity(1);
	   0 255  
	0    ,255    
	
	//  
	sprite->setColor(ccc3(255,0,0));
	//ccc3(255,0,0),      RGB  、 、 
	
	//    
	sprite->setVisible(false); 
	//false       
	//ture     
	//   
	sprite->setDisplayFrame(...);

	//user data      cocos   
	char * buf= "helloword";
	sprite->setUserData(buf);
	char *p=(char *)sprite->getUserData();
	CCLOG("user data is %s",p);
	
	//         
	sprite->setUserObject(sprite);
 	
 		
 		
 		
 		
 		
 		
 		
 		
 		
 		
 		
 		

좋은 웹페이지 즐겨찾기