Yes, it was my first extension for Defold, but I’ve had some little experience with writing such native plugins for Adobe AIR and Unity - in general the approach is pretty the same, you need to make a “bridge” between native code and engine code.
I’ve spent about 5 hours from googling “defold native extesion” to having first impact-vibrations on my device, using the first iteration of the extension, so the process was pretty smooth. I was expecting more issues and spending 2-3 days just to make it to work.
Good part - having lots of ready extensions with open sources, so I was looking and getting different parts from defreview, vibration, admob extentions and looked through few others. Plus for iOS part I’ve looked at pretty the same plugin made for Unity.
Bad part - I felt some lack of documentation. Looking at other solutions is ok, but in general I was not really understanding what am I actually doing.
For example - there is DM_DECLARE_EXTENSION(EXTENSION_NAME, LIB_NAME, AppInitializeTaptic, AppFinalizeTaptic, InitializeTaptic, 0, 0, FinalizeTaptic)
line and I have no idea what it does and why in some extension there is “Update” function and in others there is “0” (I’ve tried both and nothing changed).
Or when I wanted to use constants like “taptic_engine.IMPACT_LIGHT” I just looked through different extension’s sources to find such thing and did not find such instructions in docs.
Or getting parameters via luaL_checkint()
, luaL_checkstring()
- it’s not obvius how this works, what is the “stack” in this circumstances etc.
Maybe I missed it in docs, maybe it’s obvious things for C++ developers, but anyway - if I was able to make it work just in 5 hours, then I believe everything is pretty enough to make your own extensions
I think adding some additional paragraphs like “if you want to get parameter, use this API”, “if you want to declare constands, do this”, “if you need to return value - do this, and if your method is void - then do this” etc might be helpful.