How to set up Eclipse workspace, to develop for Android but test in Java?
I'm planning to start up a game project for Android 3.0 using Eclipse as IDE. During development, what I ideally want is the ability to build and run the game in JRE on my own OS. That is, I'm developing for Android but I'd rather not test on the included emulator, or on a physical device, until later on.
To achieve this, I'm going to isolate the game logic classes from the platform dependent classes and create an interface for the platform dependent classes to communicate with the game logic classes. For example, to run the game on Android, I'll let the Android specific classes (MyActivity, MyRenderer, etc..) send user input, update the game 开发者_如何学编程and then extract the data needed to draw the game to the screen.
But as I mentioned at the start, ideally I want to be able to develop the game logic as a Java project. I'm looking for some advice on how to set this up workspace wise. Should I develop the game logic classes in a separate project, and export as a library? Is there a better way to set things up so that an Android project and a Java project use the same classes? My ultimate goal is fast development in Java, and easy "conversion" to Android.
Should I develop the game logic classes in a separate project, and export as a library?
That would be my approach. Your game logic would create a JAR that your Android project would use.
精彩评论