Page 1 of 2 12 LastLast
Results 1 to 10 of 24

Thread: Pascal on Android: I made it work!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Pascal on Android: I made it work!

    Hey guys,

    After a long time of silence, I decided to do some pascal development again. I bought an ASUS EEE pad transformer recently, and I would like to see if I can create some games/apps for it.

    I allready fiddled with JAVA, which is the main tool for creating apps for android. The tools google delivers are really easy to use IMHO, so for any non-performance-critical apps JAVA is just fine. However, when it comes to games, I'd like to benefit from the extra performance that a compiled language can deliver.

    So today checked out these tutorials to get started:

    http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM
    http://wiki.lazarus.freepascal.org/Android_Interface

    There are easier ways. In retrospect, I didn't HAVE to build everything from source lol . On the other hand, I now have FPC 2.7.1 and Lazarus 0.9.31 (the brand new ones, I believe) to play with.

    I must say that it was quite a struggle. It took me over 5 hours, but in the end, I got that sample working (2nd URL). To be honest, the UI was too small and didn't work that well, but it's still pascal code under the hood. Moreover, I won't be using pascal for any android UI's, because there isn't much support yet, and doing that part in JAVA is more effective.

    But what's next? Does anybody know whether SDL works? And if not, how do I go about accessing audio/touch/accelometer functionality?

    Thanks
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2
    Congratulations mate! I will have to try some of this myself as I have an Android tablet

    cheers,
    Paul

  3. #3
    hmm...it seems that I need Android 3.x on my device first, so I don't think I will bother going this route then (I only have 2.3.x ATM).

    I will have a play with RemObjects' Project Cooper (Oxygene for Java (and Android)) and see if I can get something running that way instead, even though I have to get used to the syntax first LOL

    cheers,
    Paul

  4. #4
    hmm...it seems that I need Android 3.x on my device first, so I don't think I will bother going this route then (I only have 2.3.x ATM).
    I don't really see the problem with this. What happened?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  5. #5
    Quote Originally Posted by chronozphere View Post
    I don't really see the problem with this. What happened?
    The problem is that I don't have a 3.x version of Android available for my device yet, only 2.3.x. This means I would have to wait to try this method out till after I can get a later version installed.

    cheers,
    Paul

  6. #6
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Does anybody know whether SDL works?
    I believe that is possible, I recall a discussion about this earlier on in the year, I'll run a forum search and see if I can pull anything up, HOWEVER - if sdl is slow on a PC and that has many GhZ and many gigs of RAM (despite less pixels to shift) unless your on the new A(5 is it?) which have 2 cores I can't see it being the best idea. My suggestion would be to either look into OpenGlES and write a compact little unit or to look into ZenGl, I know Andru's been putting in some magic stuff there and it runs on just about anything that has a transistor in it.

    Aside from all that, theres a FPC 2.7.X out?! We're still on 2.5.5 in the APT repos... I'll have to check out my debs manually then. Oh, and one last thing: does the new lazarus interface still have those one million and one pesky windows floating about?
    Last edited by code_glitch; 28-10-2011 at 02:28 PM.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  7. #7
    Quote Originally Posted by paul_nicholls View Post
    The problem is that I don't have a 3.x version of Android available for my device yet, only 2.3.x. This means I would have to wait to try this method out till after I can get a later version installed.

    cheers,
    Paul
    Why not develop for 2.3? Nothing wrong with that. It's all possible.

    Well, I will use SDL in conjunction with OpenGLES. However, it seems that SDL Audio doesn't completely work on android yet, so I might just go for pure OpenGLES with another sound library (any suggestion that works for android?). Maybe I should just wrap the JAVA audio API via JNI, but that's no fun at all.

    And FPC 2.7.1 was build from the most recent development snapshot, so it's not the stable one. You can get it here: http://www.freepascal.org/develop.var The APT repo's (guess you are using an ubuntu/debian derivative) aren't updated frequently. I had to get debs or build things from source quite often to be honest.
    Lazarus hasn't changed that much. The only difference I have found yet, is that you can't rebuild the LCL anymore via the menu's, because it's now a package (which is automatically rebuild for your target when neccesary ^^)
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  8. #8
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    What if you wanted to make a cross-platform game for both android and iOs for example? One code-base not 2 would make thinks go half as long no?

    If I got Garland's Quest on the iPad and then wanted to share the love with Android users I would strongly consider using oxygene for java to port it. I may even think about using prism to get it on the XBox 360 too, but that's a different topic.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #9
    Yes, being able to compile to both android and iOS is very interesting. But how is that possible? Cooper generates java bytecode, which doesn't run on apple devices.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  10. #10
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Quote Originally Posted by chronozphere View Post
    Yes, being able to compile to both android and iOS is very interesting. But how is that possible? Cooper generates java bytecode, which doesn't run on apple devices.
    If your core game code is in object pascal you can easily rewrite the rest for each platform. So you take your object pascal units and other game specific code and create a new Xcode project using the Objective-Pascal templates and put them in there and rewrite the code required to support the API and other iOS specific framework to work with it.
    Jason McMillen
    Pascal Game Development
    Co-Founder





Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •