Study Notes on cocos2d-x (23)-others (screen rotation, schedule, system language)

Source: Internet
Author: User

Small man (Bill man) Personal Original, welcome to reprint, reprint please indicate the address, small man (Bill man) column address http://blog.csdn.net/bill_man

At this point, our major knowledge points have been involved, and there are sound (the next article), followed by some small knowledge points. This time I will write about screen rotation, schduler, and get the system language.

1. Screen Rotation

You can use getdeviceorientation and setdeviceorientation to obtain the screen orientation and set the corresponding screen orientation respectively.

In this example, you can use setdeviceorientation to set the screen orientation based on the screen orientation. The usage is very simple and will not be explained too much.

2. Schedule

3. There is a method to call a function on time in the cocos2d-x. After defining this, the method will be called every time until unschduler

The following describes how to register a method called on time.

Schedule (schedule_selector (schedulerautoremove: autoremove), 0.5f );

In this way, autoremove will be called on time.

The usage of unschedule is as follows:

Unschedule (schedule_selector (schedulerautoremove: autoremove ));

In this way, autoremove will not be called. In kjava games, the thread method is often used for logic and rendering every frame. We can use schdmove to implement this approach.

Call ccschedget: sharedscheduler ()-> pausetarget (this); pause to pause all schdget

Call unscheduleallselectors (); or ccschedtors: sharedscheduler ()-> unscheduleallselectors ();

There is a fixed call method, that is, scheduleupdate will call the update method once in about 0.01 seconds (reload)

3. Obtain the System Language

The following method is used to obtain the current language of the system:

Cclanguagetype current1_agetype = ccapplication: sharedapplication (). getcurrentlanguage ();

See

Obtain the corresponding language and display it on the screen

I just started to study this engine. If there are any errors, I hope you can correct them more.

Next, write down the sound system

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.