Thread overview
Polling on D for Android
Apr 14, 2023
Hipreme
Apr 14, 2023
H. S. Teoh
Apr 14, 2023
Hipreme
Apr 14, 2023
Adam D Ruppe
Apr 16, 2023
Hipreme
April 14, 2023

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.

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.

  3. What more did I forgot here? What would be acceptable to you?

As far as I would like to help community for that, setting up both for WASM and Android has a lot of things related to what you're doing and this was proposed because it is a more generic requirement I found on D for Android.

The context in which I say is basically: I have an Android studio project setup with some folders and functions that calls my engine, same applies to WASM. But I think it is not that hard to make them more generic.

April 14, 2023
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

-- 
If it breaks, you get to keep both pieces. -- Software disclaimer notice
April 14, 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.
April 14, 2023
On Friday, 14 April 2023 at 17:40:17 UTC, H. S. Teoh wrote:
> (3) An easy way to render text on a GLES canvas. There's a system libfreetype on Android


I betcha you could use the self-contained arsd.ttf (which is a port of stb_ttf plus some convenience functions i put on top of it). I do it with opengl on desktop easily enough.
April 16, 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:
>> [...]
>
> 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.
>
>
>> [...]
> [...]
>
> 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


Yo! I have been working towards making it easier and easier to use for Android. Maybe you could try using my engine for Android?  It works building to Android from all OSes, maybe you could try? https://github.com/MrcSnm/HipremeEngine


Just run `dub` on tools/user/build_selector, just follow the easy instructions in a manual setup there, for gamePath try `projects/start_here` for the time.