Using andEngine from emacs
I was trying to test some game programming in android, a good looking library is AndEngine, the tutorials I found were Eclipse centered, but after trying and ending a couple of times with a segfault, importing a project! it's time to go back to the classics, so let's see how to do it with emacs.
Install android-mode
We'll get android-mode, to install
it download it to the path, if we want it to be global we'd do it to /usr/share/emacs/site-lisp/
(to do this, root permissions may be required), or else we could add the
directory to the path with
1 |
|
After that, we have to load it and set the android SDK path, I placed it on
/home/kenkeiras/.android-sdk/
, so...
1 2 |
|
This things can be done in the *Scratch*
buffer, but we'd have to repeat
it every time we'll use the plugin, or write it on the init.el
file to do it on startup, if we want to apply the changes at the moment we'll
do it pressing C-x C-e
(Control-x, Control-x) on each day end.
Create a project
Once we have this installed we'll have to create a project, to do this
type M-x android-create-project
(Alt-x android-create-project) on emacs,
the plugin will ask for a directory to place the project on, a name for the
package and the main activity and a target. The target is the Android version
to “compile” the code for, push Tab twice probably will make it show the
available options (I'm not sure, since it may be emacs-live
doing).
With that we'll have created the project, if we type
1 |
|
and
1 |
|
it'll build the project and transfer it to the active device, and then it can be launched.
Building AndEngine
To do this we'll download the project on other directory, for example from the repository
1 |
|
Inside the directory we'll create a file named local.properties
with the SDK path, in my case
1 |
|
With this done, we may build (taking into account that the API version is 15 by default, this can be changed in project.properties
).
1 |
|
Will produce a classes.jar
file in the bin
directory, which has to be copied
to the libs
directory of our project.
Sample code
At last, we'll check if it works with some code taken from Beggining andengine
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
It's not the big thing, but it works
(Yes, is a green screen :P)