4.4. Use Libgdx to query runtime environment attributes, 4.4 libgdx

Source: Internet
Author: User

4.4. Use Libgdx to query runtime environment attributes, 4.4 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)


Can Games Written in libgdx run on Windows?

Vs2005 does not seem to be able to be installed on win8. It has to be installed on win8, but vs2005 is required for work. If it cannot be installed, it will be troublesome;

Why does eclipse fail to run programs when importing libgdx demos?

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.