4.4. Use libgdx to query running environment attributes

Source: Internet
Author: User
Tags libgdx

(Original: http://www.libgdx.cn/topic/46/4-4-libgdx%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95%E6%9F%A5%E8%AF%A2%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83%E7%9B%B8%E5%85%B3%E5%B1%9E%E6%80%A7)

The application interface provides multiple methods to query the running environment attributes.

Obtain the current application type

Sometimes you need to perform special operations based on a specific platform. Application. GetType () is used to return the currently running platform. The example is as follows:
Switch (GDX. App. GetType ()){
Case Android:
// Android specific code
Break;
Case desktop:
// Desktop specific code
Break;
Case webgl:
// HTML5 specific code
Break;
Default:
// Other platforms specific code
}
In Android, you can also query the current Android version:
Int androidversion = GDX. App. getversion ();
This will return the current SDK version. For example, 3 corresponds to android1.5.

(Www.libgdx.cn is copyrighted. If you need to reprint it, indicate the source)

4.4. Use libgdx to query running environment attributes

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.