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?