Android game development framework LGame-Android-0.2.5R released

Source: Internet
Author: User

Source code and class library is as follows: http://loon-simple.googlecode.com/files/LGame-Android-0.2.5R.rar

 

Basic components include:

 

 

Lgame-Android (LA) is a 2D game rapid development framework that can run on Android and its compatible derivatives. It can (theoretically) run on android1.1 and later. This release of the LGame-Android-0.2.5R version, improved through the LGame-Simple-0.2.5, so it can also be considered as a transitional version between LGame-0.2.5 to 0.3. In terms of practical use, it is currently released mainly to collect the user opinions of the LGame-0.3 version, and version 0.3 will also become one of the main branches of the lgame framework.

The basic architecture of the lgame-Android version is highly consistent with that of the PC version, but the differences are slightly different. This gap will gradually narrow as the version is updated. Of course, this framework has no intention to develop into a QT framework, nor does it advocate sacrificing the features of the system platform simply to encapsulate APIs, so it will always maintain a certain number of local functions.


First, the usage of lgame in Android is very simple. You only need to introduce the relevant class library to run it, or even do not need to configure XML (if you want ).

 

 

PS: If you use lgame for game development, even the XML ad settings of AdMob can be omitted. You only need to configure the advertisement account, keyword, and display location in the lgame function, refresh time and other parameters can be used.

 

Secondly, the simplest lgame-Android Application consists of the following elements:

1. An activity inherited from lgameactivity

 

Package Org. loon. test; <br/> Import Org. loon. framework. android. game. lgameactivity; <br/> Import android. OS. bundle; <br/> public class main extends lgameactivity {<br/> Public void oncreate (bundle icicle) {<br/> // when this parameter is true, otherwise, the portrait is displayed. <Br/> // In addition, you can set AdMob ad parameters during initialization to avoid tedious configuration of the XML file. <br/> // This section will be added in the next few days. <Br/> This. initialization (icicle, false); <br/> // main game form <br/> This. setscreen (New testscreen (); <br/> // refresh rate <br/> This. setfps (30); <br/> // whether to display the update rate <br/> This. setshowfps (true); <br/> // whether the logo is displayed <br/> This. setshowlogo (false); <br/> // display form <br/> This. showscreen (); <br/>}< br/>}

 

2. Create Screen

 

Package Org. loon. test; <br/> Import Org. loon. framework. android. game. core. graphics. lgraphics; <br/> Import Org. loon. framework. android. game. core. graphics. screen; <br/> Import android. view. keyevent; <br/> Import android. view. motionevent; <br/> public class testscreen extends screen {<br/> Public void draw (lgraphics g) {<br/>}< br/> Public Boolean onkeydown (INT keycode, keyevent e) {<br/> return false; <br/>}< br/> Public Boolean onkeyup (INT keycode, keyevent e) {<br/> return false; <br/>}< br/> Public Boolean ontouchdown (motionevent e) {<br/> return false; <br/>}< br/> Public Boolean ontouchmove (motionevent E) {<br/> return false; <br/>}< br/> Public Boolean ontouchup (motionevent e) {<br/> return false; <br/>}< br/>}

 

So far, for anyone who has used the lgame PC Edition, the rest of the operations will be easy to learn. (Content will be added in the next few days)

In addition, for the sake of Android efficiency, a simple multi-threaded screen class is added, that is, threadscreen. This class is inherited from screen, which is used to separate specific business and image refresh in development.

PS: the thread in the screen will automatically log out when the screen is switched or the program is closed.

Screen with thread:

 

Package Org. loon. test; <br/> Import Org. loon. framework. android. game. core. graphics. lgraphics; <br/> Import Org. loon. framework. android. game. core. graphics. threadscreen; <br/> Import android. view. keyevent; <br/> Import android. view. motionevent; <br/> public class testthreadscreen extends threadscreen {<br/> Public void drawscreen (lgraphics g) {</P> <p >}< br/> // gameloop is always in the active thread. The thread refresh speed can be indicated by the setsynchrofps () function. Number Control. <Br/> Public void gameloop () {<br/> // In threadscreen, repaint is required for image refresh to take effect <br/>}< br/> Public Boolean onkeydown (INT keycode, keyevent e) {<br/> return false; <br/>}< br/> Public Boolean onkeyup (INT keycode, keyevent e) {<br/> return false; <br/>}< br/> Public Boolean ontouchdown (motionevent e) {<br/> return false; <br/>}< br/> Public Boolean ontouchmove (motionevent E) {<br/> return false; <br/>}< br/> Public Boolean ontouchup (motionevent e) {<br/> return false; <br/>}< br/>

 


A few differences with the PC version:

In Android, replace graphics2d with lgraphics (this type is also used in PC version 0.2.5r. The API is highly consistent with graphics2d and has some extensions). limage replaces image and bufferedimage (Bitmap encapsulation ), lfont replaces font. In addition, the createimage functions in graphicsutils are returned to limage in Android, And the getfont functions are returned to lfont.

Partially canceled for Android:

Pshadoweffect, lmagniier, and lplayer: these three types Use pixel rendering in the PC version. The same pixel drawing method makes the speed of Android really tragic, use openes in version 0.3 ......

Media package for PC: mediaplayer is directly encapsulated in lgame-Android and provides assetssound and assetssoundmanager. (In fact, because mediaplayer is unfriendly to data streams, the audio file in lgame-android must be in the assets folder, and the related classes start with "assets" to show differences)


Configuration details:

For most games with fixed horizontal and vertical versions, we need to use androidmanifest. configure the Android: configchanges = "orientation | keyboardhidden" parameter in the activity tag in XML to prevent the game from being restarted and the keyboard from popping up when the screen direction changes. In addition, before performing any operation that requires read/write permissions, make sure that the Operation permission is configured in androidmanifest. xml. Otherwise, the operation will not take effect. (For example, for network connection, you must note: <uses-Permission Android: Name = "android. Permission. Internet"/> ). For more information, see related documents.

Finally, for the convenience of debugging, with lgame-android together with the PC version of The LGame-0.2.5R.

 

Source
Code and Class Library: http://loon-simple.googlecode.com/files/LGame-Android-0.2.5R.rar


PS: this blog is not over yet. It will be completed in about five days.

 

----------------

 

The younger brother has a cup today. It's just a rainstorm in Beijing. It's late and has no umbrella. |. If I fail to finish writing this article in advance, I have to update it slowly ...... A patient Comrade can test the class library and leave a message to discuss with his younger brother. It is expected to be completed in about five days. In short, there is no pass-off ......

 

In addition, you don't have to worry about efficiency. The core part of version 0.3 has been replaced by OpenGL ES, which is expected to be released in the period from 9 to 10 months.



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.