简体   繁体   中英

Developing for Multiple Platforms

I have a partially developed Java game which runs fine on my Windows PC. I want to maintain the PC version, but also start porting it to Android. For the mostpart, the classes handling the calculations and gameplay are separate from the GUI functions already.

I'm using Eclipse, so should I keep both versions in the same project, for example? I'm hoping that my gameplay classes and methods don't have to be modified and that all I need to do is add an activity for my Android device which will include its display / user input functionality. Do I need to create a new project and copy my methods?

Is there a standard process for any of this?

I think you should use your current code, by creating a library and importing it into your Android project. To this you can either

A. Cut and paste the current class into the Android code. This makes maintenance a little harder.

B. Add the library by right clicking on the project in Eclipse and go to Build Path > Configure build path. In there you will find a Libraries tab. Click it and select "Add new". The rest should be pretty intuitive.

I'd opt for the second option, and it is easier to maintain and implement into the new project.

I would recommending a different project. This way you keep the overhead for each project clean. It wouldn't be much of a hassle to copy paste any changes in the COMMON classes (library classes) used on each project. At the end you benefit of a cleaner work environment with 2 projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM