bottom
Step 4: Set the position. There is nothing to say. Set the position directly.
Step 5: start by using CCRepeatForever (repeated) to pass in the CCProgressTo object
I just started to study this engine. If there are any errors, I hope you can correct them more.
Next, let's take a look at other scenarios in the test class.
CCProgressTimer * progress1 = CCProgressTimer: create (CCSprite: create ("Icon.png "));
Progress1-> setPosition (ccp (100,1
Today's test found a problem with the game, System mail, assuming the tab, on Android on the open message content will be crash. And they're pretty sure it's the tab question.With my many months of experience (indeed not for many years.)。。 View Never heard of a tab crash on Android. And assume that there is this problem. There will certainly be a lot of people, expected to be noisy, search for a bit, what information is not available.So I wrote a test project and tested it. 4 txt documents were
state button picture//fourth parameter in the Menu_selector is the menu selector, Cocos2d-x also have a lot of selectors, first remember, menuclosecallback corresponding to the callback function, The third argument, this, represents which class's callback function Ccmenuitemimage *pcloseitem = ccmenuitemimage::create ("Closenormal.png", "Closesele
Cted.png ", this, Menu_selector (Helloworld::menuclosecallback));
CC_BREAK_IF (! Pcloseitem); Set the coordinates of this button,
corresponding button processing event
void Yesbutton (Ccobject * object);
void Nobutton (Ccobject * object);
Sets the title
void Settitle () for the dialog box;
Sets the text content of the dialog box
void SetContent ();
M_size represents the size of the dialog box background
ccsize m_size;
dialog box Background elf
ccsprite * m_bgsprite;
#endif
/* Dialog scene class implementation of the specific * * * #include "PopScene.h" Ccscene * Popscene::scene () {ccscene * scene = NUL
The background picture loops through the actions implemented using the action:
There are two main background images alternating cycle scrolling: the width of the two background images I chose is 1024, so defines the # define Bgimg_width 1024
The code is as follows:
Declare two background image sprites in HelloWorld.h's header file
#import "Cocos2d.h"
//Helloworldlayer
@interface helloworldlayer:cclayer
{
ccsprite *bagsprite1;
Ccsprite *bagsprite2;
}
Part of the code implemented in t
-profile ID 0Service-set ID 1
Actual configuration: Command line configuration:[Huawei]dis current-Configuration # HTTP Secure-server ssl-Policy default_policy HTTP server enable# clock timezone Bei Jing time Add ,:xx:xx# DNS Resolve #vlan batch123 2001#lldp enable #pki Realm default enrollment self-SIGNED#SSL policy default_policy type server PKI-Realm DEFAULT#AAA Authentication-Scheme Default Authorization-Scheme default Accounting-scheme Default domain Default dom
For some configuration when a control is used, see article: Control class-cccontrolbutton for UI development. Here only the source code, the inside of the comments on the control of the use of a detailed description.
BOOL Helloworld::init () {bool BRet = false; do {cc_break_if (!
Cclayer::init ());
Sets a label Cclabelttf * title = cclabelttf::create ("Slider value = 0.00", "Arial", 32).
Title->setposition (CCP (240,200));
The tag is s
/////////////////////////////////////// ///////////////////////////////////
9
10 CC_BREAK_IF (! CCLayer: init ());
11
12 /////////////////////////////////////// ///////////////////////////////////
13 // add your codes below...
14 /////////////////////////////////////// ///////////////////////////////////
15
16 // 1. Add a menu item with "X" image, which is clicked to quit the program.
17
18 // Create a "close" menu item with close icon, it's an auto release object.
19 CCMenuItemImage * pCloseIt
Code first
1 // cpp with cocos2d-x
2this-> setIsTouchEnabled (true );
1 // objcwith cocos2d-iphone
2self. isTouchEnabled = YES;
In this way, we can get the touch event.
Declare the callback function "void ccTouchesEnded (cocos2d: CCSet * touches, cocos2d: CCEvent * event);" in HelloWorldScene. h and implement this function in HelloWorldScene. cpp.
1 // cpp with cocos2d-x
2 void HelloWorld: ccTouchesEnded (CCSet * touches, CCEvent * event)
3 {
4 // Choose one of the touches to work
5 CCTouch * to
1. Definition of template specificityTemplate specificity in C + + is different from the instantiation of templates, and the specific implementation of template parameters under a particular type is called template specificity. Template specialization is sometimes referred to as template materialization, with function template specialization and class template specialization, respectively.1.1 Function template Special function template specificity is when a unified function template does not wor
Summary of the new callback function in Cocos2d-x 3. xBecause of the introduction of C ++ 11 characteristics, many implementation schemes in cocos2d-x 3.x, compared with the previous cocos2d-x 2.x, have a great improvement, of course, the performance has also been improved. This article focuses on the changes in the callback function from 2. x to 3. x. Cocos2d-x 2. x era callback function 2. X era mainly using CCCallFunc, CCCallFuncN and CCCallFuncND and other methods to achieve. Both CCCallFunc
point CCPoint ptLocation = touch-> getLocation (); // ptLcocation-> coordinate in the tmx map // obtain the size of each graph block in the map CCSize tileSize = _ map-> getTileSize (); // obtain the number of chunks in the map. CCSize mapSize = _ map-> getMapSize (); CCPoint ptInMap; // obtain the coordinate ptInMap of the touch point in the map. y = mapSize. height * tileSize. height-ptLocation. y; ptInMap. x = ptLocation. x; // obtain the coordinates of the touch point in the window. int tx
Fonts in Cocos2d-X
There are three ways to display text in a Cocos2d-X:
CCLabelTTF: The system font is used. Each character string generates a texture, which is less efficient and suitable for non-changing text.
CCLabelAtlas: Uses NodeAtlas to optimize rendering. It is suitable for numbers that change frequently, such as scores and money.
CCLabelBMFont: it is flexible to use CCSpriteBatchNode. Each character is an genie. You can operate on each character and use the image directly to draw the te
Understanding of cocos2d-x ios game development (5) CCsprite genie, cocos2d-xccsprite
This time I will write several types created by the genie:
1. Create a file:
Add the following code on the original basis:
// 1. Create an genie through a file
CCSprite * bg = CCSprite: create ("map.png ");
CCSize winSize = CCDirector: sharedDirector ()-> getWinSize (); // obtain the screen size.
Bg-> setPosition (ccp (winSize. width/2, winSize. height/2 ));
This->
First of all for beginners, take everyone to understand the concept of coordinate system in cocos2d-x, refer to http://blog.csdn.net/tskyfree/article/details/8292544. Let's look at the rest.
Understanding the coordinate system is an important step to start development. To make everyone feel dizzy, I am going to explain it to you in depth. My original address is http://www.cnblogs.com/lyout/p/3292702.html.
First, we add two test genie (width: 27, height: 40) to the scenario:
CCSprite *sprite1 = C
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.