Polling on D for Android

Hipreme msnmancini at hotmail.com
Fri Apr 14 18:09:49 UTC 2023


On Friday, 14 April 2023 at 17:40:17 UTC, H. S. Teoh wrote:
> On Fri, Apr 14, 2023 at 03:57:12PM +0000, Hipreme via 
> Digitalmars-d wrote:
>> Hello Guys.
>> I have been implementing complete automatizations on my Game 
>> Engine
>> for actually building easily for any platform. i.e: You don't 
>> need to
>> set it up, you just run my script, select the platform you 
>> want and it
>> will handle all the pesky details.
>> 
>> I have done that already for MacOS and WASM, and right now I'm 
>> finishing one for Android which basically tries to find your 
>> SDK and NDK, if doesn't find, it auto installs and set it up 
>> for you and also let you build your D code for it (currently 
>> only my engine is targeted).
>> 
>> And this is something I would like to ask: Is there anyone 
>> more wanting to use D for Android here? I could try making the 
>> code a little more flexible (not that much). I know that 
>> nowadays working D for Android requires quite a lot of reading 
>> and that is pretty bad and time wasting.
>
> I'd love to have a nicer D interface to Android.  I like to 
> install the SDK/NDK by hand, so it would be nice if it was 
> possible to point your script to a custom installation location.
>
>
>> So, that being said:
>> 
>> 1. What would you like to do between Android and D? I 
>> personally don't recommend anyone actually dealing with 
>> Android interface from D because this is a ground not yet 
>> explored by me (i.e: I don't use native activity, it is pretty 
>> painful).
>>
>> 2. What would you need? Currently my engine has a module that 
>> supports binding to java functions, it supports logging, those 
>> are the useful things.  It is not as complete as arsd.jni. 
>> This part I don't really intend to develop for the community 
>> but it would be good to know what you need.
> [...]
>
> It would be nice to have:
>
> (1) An easy way to create a text window for displaying log 
> messages / debug messages for development. It's possible to do 
> this manually of course, but it's just an extra barrier (you 
> have to debug the debug window before you can debug the 
> program!).
>
> (2) An easy way to create window and get a GL / GLES rendering 
> context / canvas from it, that D code can use for further 
> operations. I have an Android project (currently on the 
> backburner) that does this manually, and it's just a lot of 
> fiddly boilerplate. Would be ideal if a single function call or 
> two could do it all for me.
>
> (3) An easy way to render text on a GLES canvas. There's a 
> system libfreetype on Android but it's not very accessible to 
> user code the last time I checked, you have to ship your own 
> version of libfreetype, etc., etc.. It's just a lot of manual 
> work, and mostly just boilerplate. Some way of automating this 
> away would be very nice.
>
>
> T

So, about specifying the SDK/NDK, my engine does that quite 
simply: It downloads and installs them if not found in default 
paths, then it saves on a configuration file where your ndk is 
located. So, you will still be able to run it manually.


For 2 and 3 are really easy, all you need is to link to libGLES 
and use the same project structure I use in my Android Studio 
project, but since my engine already does that, I don't plan into 
implementing that myself. Also, I would not use libfreetype 
specially since we already have arsd-official:ttf out there, 
which is basically D code so it is easier to get working with.

For 1, why not use LogCat? I made my logging command to actually 
output there. You can connect to it without Android Studio also.


More information about the Digitalmars-d mailing list