Use of ccuserdefault in cocos-2d

Source: Internet
Author: User

The use of ccuserdefault in cocos-2d is very simple, there is a great God on the Internet (http://blog.csdn.net/honghaier/article/details/8814551) has all commented on this class, at a glance. Thank you very much!

The following describes how to use this class as a fool

1. Introduce the header file in the class to be used

# Include "support \ ccuserdefault. H"

# Include "stdio. H"

# Include "stdlib. H"

2. Set the corresponding value

Ccuserdefault: shareduserdefault ()-& gt; setdoubleforkey ("double", 2.4 );

3. Get the corresponding data

Double D = ccuserdefault: shareduserdefault ()-> getdoubleforkey ("double ");

Some parameters are stored during the game so that some data can continue to exist during the next game, such as the amount of money. I personally think it is much easier to use than plist!

Note the location of the XML file, which is under the Debug. Win32 Directory!

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.