Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Android

This thread is locked; no one can reply to it. rss feed Print
Android
cmoibenlepro
Member #7,961
November 2006

Is it possible to use Allegro to develop games for the Android platform?
If yes, how?
thanks

Matthew Leverton
Supreme Loser
January 1999
avatar

Thomas Fjellstrom
Member #476
June 2000
avatar

Not yet 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

LennyLen
Member #5,313
December 2004
avatar

How's progress Thomas?

Thomas Fjellstrom
Member #476
June 2000
avatar

LennyLen said:

How's progress Thomas?

Pretty good. Though I decided/was-convinced that it was a better idea to do the 1.6+ port first/instead. So I pretty much restarted once. Much of the java for that is done, just needs some jni C to go with it.

That said, I've had to put the android porting on hold for a short bit. I have to finish some exterior renovations this month and that's taking up a fair bit of time. I'll get back to the port ASAP though.

--
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

Who is helping you to do the port?

Timorg
Member #2,028
March 2002

This is where I turn around and offer to help with testing. Since Thomas started the port I have got a HTC Desire (2.4 I believe), and an A500 Iconia Tablet (3.0.1) (this was a graduation present, but that's another thing entirely.)

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

MiquelFire
Member #3,110
January 2003
avatar

There is no 2.4 of Android (yet, waiting for Ice Cream Sandwich to get a number, it might be 3.1 or 2.4)

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
Windows 8 is a toned, stylish, polished professional athlete. But it’s wearing clown makeup, and that creates a serious image problem. ~PCWorld Article

Thomas Fjellstrom
Member #476
June 2000
avatar

He probably means 2.3.4.

--
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

Oh yeah, if at all possible, you should put whatever code you have into allegro's SVN (or some other public repository). I also have an android device and just putting off installing the SDK until there's something to test :)

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

Thomas Fjellstrom
Member #476
June 2000
avatar

I'll try to get something actually working again this week or so. The 2.3+ port actually will run, but no drivers are hooked up yet. I should be able to get to the same point with the 1.6+ port in a couple days or so worth of work. And a few more to get all the drivers hooked up.

I think I'll push it once I get the system driver wired up and running. And the README_Android.txt docs updated. Then people can help with the drivers if they wish.

--
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

BAF
Member #2,981
December 2002
avatar

waiting for Ice Cream Sandwich to get a number, it might be 3.1 or 2.4

There's already a 3.1. I have it on my Xoom.

MiquelFire
Member #3,110
January 2003
avatar

Okay, so it would be 3.2 then. Hell, my phone was bought as a "Well since to get what I want would have a touch like thing, I'll just get a damn Android" and that ended up being a horrible way to pick out a phone.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
Windows 8 is a toned, stylish, polished professional athlete. But it’s wearing clown makeup, and that creates a serious image problem. ~PCWorld Article

gillius
Member #119
April 2000

How does native code work with Android anyway? I've played a little bit with development and have only seen Java code. But I get the impression that native code is possible because of games and apps being ported so easily between i* and Android, but I got the impression that Java is still highly preferred.

How does Allegro work there? Does it actually have to be inverted where the C code has to delegate to Java calls for the "low-level" stuff (graphics, sound, etc)? That would be very odd. Or is this more of a Java port of Allegro?

Gillius
Gillius's Programming -- http://gillius.org/

Thomas Fjellstrom
Member #476
June 2000
avatar

gillius said:

How does native code work with Android anyway?

Two ways:

  • On Android 1.6 and up, you can just use C/C++ libraries through Java and the JNI apis.

  • On Android 2.3 and up, you can use the new NativeActivity support, meaning you can make an entire android application in just C/C++. It requires a bunch of setup to handle events from android through callbacks you setup, and then setting up a retarded polling interface for input (I don't get why they didn't just make it another callback ffs).

Quote:

How does Allegro work there? Does it actually have to be inverted where the C code has to delegate to Java calls for the "low-level" stuff (graphics, sound, etc)? That would be very odd.

I started with a 2.3+ port, meaning android loads the app directly from a .so file and enters a special "main" type function to setup event hooks and program execution (it generally means setting up a secondary thread, because you CAN'T block that entry call from returning or it'll lock up your app).

I recently decided to backtrack and get the 1.6+ port finished first, because it makes more sense to do that, more possible users for that port.

The 1.6+ native code support requires a Java Activity class setup, which can then call into C from JNI and do whatever it likes from then on.

What I've done so far is setup a bunch of state in the Activity class, and basically implement what Android 2.3+ does with its NativeActivity stuff, but cleaner (for our purposes, and without the second thread for input polling.

addendum: As for delegating back to android for stuff, Yes and no. OpenGL ES is accessible to native libraries and native apps. OpenSL is newer than the OpenGL support so for the best compatibility, it'd be best to delegate sound to java.

Quote:

Or is this more of a Java port of Allegro?

Nope, you'll be able to port an entire Allegro game to it with few issues, especially if you ported to the iOS port already and it works there.

--
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

I have a little question about screen resolutions.

Android is used by a very large amount of devices, and the screen resolutions of those devices aren't standard. With the iPhone what you have to do is just set your game to the device screen resolution (when there was just an iPhone), now even to develop an iPhone game, you need to think in the old version and the new version with retina screen, you also need to think about the iPad and so... But on Android things are worse. So for indie games the "fixed game resolution" is over, I think. You know, we were used to just set our game to 800x600Px or 640X480Px but now I think is completely over.

Because even when you know that a fixed resolution game on a PC when it's at full screen it looks ugly, you know that if is using a standard resolution is going to work, and even if it doesn't you can let it as windowed mode. But when you develop a game for Android or iPhone you can't use a windowed mode.

So, all this is just to ask:

1 Will Allegro allow us use the ALLEGRO_FULLSCREEN_WINDOW to get the device resolution? You know, once is created?.

2 By doing that, our game should run in all android devices, right?

Of course our game must have a minimal resolution, because even when the game may start, if the game was made for a 320×480px screen, and you're running it on a 122×68px screen, isn't going to looks well, at least your using vectors. But in theory, should at least start... riiighht?

Elias
Member #358
May 2000

Yes, ALLEGRO_FULLSCREEN_WINDOW will work. You can also query the available resolutions. E.g. gen1, gen2 and gen3 iphones should report a single mode with 320x480 pixel. gen4 will report two modes, 320x480 and 640x960. gen1 and gen2 ipads will report 768x1024. At least that's how I remember it.

You should also listen to the various orientation change events allegro will send then when it tells you the device is oriented 90° clockwise you know that while your screen is 768x1024 pixels it really will appear as a 1024x768 screen to the user. Luckily the transformation API makes this quite easy to handle.

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

AMCerasoli
Member #11,955
May 2010
avatar

I have just sold my iPhone, there is no way I'm going to spend 700€ for a Mac Mini. I'm going to instead keep the PC as my main platform and Android as the second one. But I have some questions. I want to buy the Samsung I9100 Galaxy S2, but...

1 Can I run programs from And. 1.6 there?.

2 Can I actualize my phone from 2.3 (that is the version that comes with my phone) to 3.1?

3 What do you say about the Samsung I9100 Galaxy S2? it's too much for developing?

Thanks ;D

BAF
Member #2,981
December 2002
avatar

You won't ever see 3.0 or 3.1 on a phone.

AMCerasoli
Member #11,955
May 2010
avatar

Hmm.. I didn't know that there were different versions depending on the platform. It's the same with iOS?. Well, I have being reading and I think the answer for my first question is yes, and for the second one is no.

Again I don't understand the way they're enumerating their versions;

v 3.1-- correct
v 3.0 -- correct
v 2.3.4 -- correct
v 2.3.3 -- correct
v 2.3 -- correct
v 2.2 -- correct
v 2.1 -- correct
v 2.0.1 -- correct
v 2.0 -- why from 1.6 to 2.0?
v 1.6 -- correct
v 1.5 -- why from 1.1 to 1.5?
v 1.1

Whatever..........................

And that does mean that for smartphones the versions are always going to be 2.something? ???

Thomas Fjellstrom
Member #476
June 2000
avatar

Version numbers don't matter. Don't think about them for a second more.

Can I actualize my phone from 2.3 (that is the version that comes with my phone) to 3.1?

I would bet that Samsung might release 'Ice Cream Sandwich' (3.2?) for the Galaxy S2, but I've heard they are pretty stingy with the updates. So if they do make an 'Ice Cream Sandwich' release, it'll probably be the last one.

But as far as I'm aware, android is backwards compatible, so older apps generally work on newer devices.

--
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: