comp.lang.ada
 help / color / mirror / Atom feed
From: Per Sandberg <per.s.sandberg@bahnhof.se>
Subject: Re: GDNative thick binding design
Date: Sun, 18 Oct 2020 22:21:38 +0200	[thread overview]
Message-ID: <mt1jH.117192$pc2.66953@fx03.am4> (raw)
In-Reply-To: <9d822023-b604-46b1-9443-4471e095704bn@googlegroups.com>

Well
My usual path is:
1) find bindings in other languages and try to understand their intention.
2) Generate  a 1:1 binding to the C API since that will provide a sound 
ground (this is an 100% automatic process).
3) Write the high level binding trying to mimic othef language bindings 
while keepoing an Ada twist to it,

With a minor effort I managed to to step one and two but step three is 
the hard one have a look on https://github.com/Ada-bindings-project/godot

/P

On 15/10/2020 23:08, Michael Hardeman wrote:
> I'm working on a binding to the Godot game engine for Ada.
> Project link here: https://github.com/MichaelAllenHardeman/gdnative_ada
> 
> Once the game engine has loaded your dynamic library it will call the function *_nativescript_init (where * is the symbol_prefix defined in the library resource config file). This function is responsible for registering objects, object methods, and allocating any memory needed.
> 
> What I want to discuss here is that I'm a bit at a loss as to how to design a thick binding wrapper around this object registration pattern. So let me describe the pattern.
> 
> I have a very simple example translated from C using the thin binding is here: https://github.com/MichaelAllenHardeman/gdnative_ada/blob/master/examples/gdnative_c_example/src/simple.adb#L44
> 
> The objects must have a name, but may or may not override the constructor/destructor life cycle functions (which you pass in during registration)
> There are
> https://docs.godotengine.org/en/stable/classes/class_object.html#class-object
> 
> There is kind of a hierarchy at play as well:
> 
> the Node type extends Object
> https://docs.godotengine.org/en/stable/classes/class_node.html#node
> 
> and has addition life cycle events like _process (callback on each frame)
> https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-process
> 
> Now I don't even know where to start defining something nice in Ada that would match this pattern and would hide all the nastiness from the C binding. I kind of want the tagged record hierarchy structure, with overriding functions, but it should only register methods with godot you've overridden. How would I know what methods have been overridden? I feel like I need some kind of generic or helper functions?
> 
>   I'm hoping some more experienced people might have some suggestions?
> 
> 
> 

  parent reply	other threads:[~2020-10-18 20:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 21:08 GDNative thick binding design Michael Hardeman
2020-10-16  6:38 ` Luke A. Guest
2020-10-16 16:39   ` Michael Hardeman
2020-10-16 18:09     ` Luke A. Guest
2020-10-16 18:28       ` Michael Hardeman
2020-10-16 18:31         ` Luke A. Guest
2020-10-21  2:58           ` Michael Hardeman
2020-10-21  6:59             ` Luke A. Guest
2020-10-21 22:08               ` Michael Hardeman
2020-10-21 23:22                 ` Luke A. Guest
2020-10-26  3:38                   ` Michael Hardeman
2020-10-26  5:41                     ` Per Sandberg
2020-10-26 13:53                       ` Michael Hardeman
2020-10-27  3:34                         ` Michael Hardeman
2020-10-17 10:09         ` AdaMagica
2020-10-18 20:21 ` Per Sandberg [this message]
2020-10-21  3:34   ` Michael Hardeman
2020-10-21 16:16     ` Per Sandberg
2020-10-21 22:48       ` Michael Hardeman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox