Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 5.1 and Android?

Credits go to Thomas Fjellstrom for helping out!
This thread is locked; no one can reply to it. rss feed Print
Allegro 5.1 and Android?
Jorhlok
Member #12,490
January 2011

Hi. How far along is allegro 5.1? Also, is Android support going to be included?

I ask because I'm doing a mobile game with a group I'm in and the quick graphics demo for 5.0 is already running on another of my group's iPhone.

Thomas Fjellstrom
Member #476
June 2000
avatar

Jorhlok said:

Hi. How far along is allegro 5.1? Also, is Android support going to be included?

Yeah, theres an Android port in progress, I just need to do a little more work on it before its actually ready to be used in a game. You could start though, graphics work, as do input, but some things like sound don't work as of yet. FS access might work, but png loading won't.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Jorhlok
Member #12,490
January 2011

Wow, that's great. Even if it's not ready by the time we're done with the current project, It'll definitely be a great choice in the future.

Mark Oates
Member #1,146
March 2001
avatar

Will png eventually be included?

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Thomas Fjellstrom
Member #476
June 2000
avatar

Will png eventually be included?

I've almost got support for android's native image loading routines in the image addon. Means it'll do jpeg, png, webp and whatever else it supports, as well as allegro's simple (bmp, tga, pcx, etc) formats.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Mark Oates
Member #1,146
March 2001
avatar

ok, gotcha.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

AMCerasoli
Member #11,955
May 2010
avatar

Man, I don't know, I have been reading a lot about the Java language in these weeks, I have even made very tiny apps, you know those which comes with the tutorials, and I have to say that the language isn't so bad as I thought.

You don't have multi-inheritances but you have all the interfaces, isn't the same, but you can get used to.

I think the Android API is pretty good too, with the frames thing and the big amount of functions that the frameworks has, but damn, I still prefer C++, the thing is I don't know if it's going to be more trouble in the long run programming with C++ or with Java... I haven't read about NDK or the other native code stuff, but I also use a lot libraries like cURL and I don't know if I can use it on Android, so if I program a game using Allegro and want some network libraries, can I use the Android APIs? or do I have to find a C/C++ networking library for Android?

Some questions:

  • I still can create a manifest.xml file when using Allegro, isn't it?

  • There will be an onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy() functions, or how can we handle those events?

  • Can I run the game in the emulator on the PC?

  • Which IDE do you recommend?, Eclipse has the ADT plug-in, it's going to work when programming with Allegro?

Thanks man, I'm a little lost. :o

Neil Walker
Member #210
April 2000
avatar

I don't know how this is done but with libgdx you just write it once and you can create a windows, unix or android version just like that and test it on windows before deploying. But as far as android goes, if you get the android SDK you get the android virtual device for test on.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

AMCerasoli
Member #11,955
May 2010
avatar

Well I think that is because porting a Java graphic library is trivial. You know that wherever java runs as far as there is OpenGL your library is going to run too. And obviously the emulator should work too. But porting a C library to Java it's not possible, at least you re-write everything from scratch using the Java API or the Android API, in fact Thomas can do it because Android has the NDK. But without it I think it wouldn't be possible. If the idiots at Microsoft had implemented something like the NDK in their phone, probably a Windows Phone7 port could be also possible.

Fortunately Android seems to be improving the NDK each day, they have support for OpenGL 2.0 now, well since version 2.0, and they released a new version on November 2011.

They say

Quote:

In general, you should only use native code if it is essential to your application, not just because you prefer to program in C/C++.

I want to use it just because I prefer to program in C++... :P

Thomas Fjellstrom
Member #476
June 2000
avatar

I still can create a manifest.xml file when using Allegro, isn't it?

One is provided with the android-project template, you can modify that as you see fit.

Quote:

There will be an onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy() functions, or how can we handle those events?

Allegro converts the ones it thinks are necessary into allegro events. Basically, the user main (where your code runs) is launched in onStart(). Then in onResume you get a display switch in event, and onPause you get a switch out event.

Quote:

Can I run the game in the emulator on the PC?

At the moment I think it may work? I'm not entirely sure. I find it far more convenient to just develop on a real device.

Quote:

Which IDE do you recommend?, Eclipse has the ADT plug-in, it's going to work when programming with Allegro?

I just use the command line and an editor called Kate. Basically the skeleton/template project comes setup with the standard android project framework, which uses ant and ndk-build to do its magic. It should also work with Eclipse but I haven't tried it. Compiling allegro itself needs you to use the command line. At least if you follow the directions. You might be able to convince Eclipse to properly compile allegro, but allegro is a bit funny in that it auto generates some headers and doesn't put them with the rest of its header before you run "make install", so without properly installing allegro, you have to do some shenanigans to get things to work.

It's probably just easiest to follow the setup directions for allegro at least.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

AMCerasoli
Member #11,955
May 2010
avatar

hmmm I see.

I can't wait to program an android game using Allegro. I need to find a cheap device, something like the Galaxy Nexus with Android 4.0... :o;D

I have been reading for some reason Ogre3D is not able to run on Android :'(, they say:

Quote:

Unfortunately the C++ for Android is currently too sparse for Ogre to be ported using the official development kit (called the NDK). The most serious feature missing the exception support. Since Ogre makes heavy use of exception, this missing feature would make it very difficult to create a stable port for Android.

I thought that exceptions were an important aspect of OOP languages... They wrote that on October, 2010, I wonder if still applies... I know that I said that Allegro5 + Ogre3D would be a dream, but no, now I think that Allegro5 + Ogre3D + Android THAT! would be a dream, this is the last one I swear it!

LennyLen
Member #5,313
December 2004
avatar

I need to find a cheap device, something like the Galaxy Nexus with Android 4.0...

I'll sell you my one... in a year or two. ;)

Thomas Fjellstrom
Member #476
June 2000
avatar

I can't wait to program an android game using Allegro. I need to find a cheap device, something like the Galaxy Nexus with Android 4.0... :o;D

Galaxy Nexus does not a cheap device make.

Last I heard NDK got mostly full C++ support including exceptions. Since the r5 release of the NDK, it has had exception support. It may or may not be tricky to get them to work properly, some people have had issues getting C++ Exceptions working on android.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

AMCerasoli
Member #11,955
May 2010
avatar

LennyLen said:

I'll sell you my one... in a year or two.

Are you crazy? in two years I will be probably living in Japan...

@Thomas: Well, I know this is a silly question... But there is a chance to use intents?, something tells me "no, there is not you idiot".

Thomas Fjellstrom
Member #476
June 2000
avatar

@Thomas: Well, I know this is a silly question... But there is a chance to use intents?, something tells me "no, there is not you idiot".

Currently no. I'm not sure how we'd fit them in either.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Jorhlok
Member #12,490
January 2011

I just use the command line and an editor called Kate.

I use the command line and GEdit (the GNOME rival to Kate).

Thomas Fjellstrom
Member #476
June 2000
avatar

Jorhlok said:

I use the command line and GEdit (the GNOME rival to Kate).

Where's the nice tree view?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Elias
Member #358
May 2000

Does this tree view not include symbols (like the one in Eclipse)?

--
"Either help out or stop whining" - Evert

Thomas Fjellstrom
Member #476
June 2000
avatar

Elias said:

Does this tree view not include symbols (like the one in Eclipse)?

That treeview is strictly for loaded files. Kate does indeed have a symbol viewer though. I just don't often use it.

APPEND/UPDATE:

I just committed full WORKING native image loading support.

Fixed a load of bugs too. Turns out I was playing fast and loose with the jni code quite a bit. Lots of errors there.

Actually had to root my phone to get access to some of the more useful debugging features.

Anyhow, have fun people. Please break it :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

AMCerasoli
Member #11,955
May 2010
avatar

Well, I guess it's time to get a new phone. There is just one more feature we need to make simple games and it's the audio support. Or it's already implemented? isn't.

In the TODO list you have "camera access". How do you plan to achieve that?, I guess the best way would be using the intents stuff, but I don't know if it's possible, however it would be a good excuse to at least try to do it. There is more than camera access in a device I guess with a very abstract set of functions you can make it? :P

Mark Oates
Member #1,146
March 2001
avatar

AMCerasoli, do you use Windows? What method did you use to compile the Allegro libs for Android?

[edit] Did you have to cross-compile anything?

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

AMCerasoli
Member #11,955
May 2010
avatar

No man, I haven't had the time to try it. Besides I don't have an Android phone. I need to buy one once and for all.

But I think after compiling Allegro there is no much difference between Windows and Linux. You have to use the NDK which works on both platforms (Windows with Cygwin). Where did you get stuck?

Thomas Fjellstrom
Member #476
June 2000
avatar

In the TODO list you have "camera access". How do you plan to achieve that?

Addon that calls into the java code (much like the image addon). The camera api is pretty straightforward to use. And I assume the addon would be useful for iOS as well. Maybe make it generic enough to use webcams on desktops?

Quote:

There is more than camera access in a device I guess with a very abstract set of functions you can make it? :P

Can you rephrase that? I just woke up, and my brain can't parse that.

Did you have to cross-compile anything?

You have to cross compile allegro even when on linux. But the Android NDK (Native Development Kit) comes with the cross compiler you need.

The README_Android.txt should explain how to get started. If there's anything you don't get feel free to ask :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

AMCerasoli
Member #11,955
May 2010
avatar

>Can you rephrase that? I just woke up, and my brain can't parse that.

:P What I wanted to say was that a device running Android may or may not have more features; camera, mim etc... And applications that allows you to for example take a picture, then with intents you call that application within your program, and no need to re-invent the wheel. But whatever, I was just saying, for what I have read about the Android API achieve that would be extremely difficult since that is very ingrained in the Android API and I don't know if in the native libraries there is something like that... Whatever... :P

Thomas Fjellstrom
Member #476
June 2000
avatar

Well, there would be no need to play with intents. The *cough* intent of the addon would allow allegro programs to capture pictures via the standard api, not make allegro apps act as a camera app.

As for the ingrained API, indeed. But so is the bitmap loading. You just have to write some java code, and call into it from the C to get things done.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: