comp.lang.ada
 help / color / mirror / Atom feed
* GDNative thick binding design
@ 2020-10-15 21:08 Michael Hardeman
  2020-10-16  6:38 ` Luke A. Guest
  2020-10-18 20:21 ` Per Sandberg
  0 siblings, 2 replies; 19+ messages in thread
From: Michael Hardeman @ 2020-10-15 21:08 UTC (permalink / raw)


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?



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-10-27  3:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-10-21  3:34   ` Michael Hardeman
2020-10-21 16:16     ` Per Sandberg
2020-10-21 22:48       ` Michael Hardeman

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