Table of Contents

30. Plugin

Create new plugin is possible and here I intend to list how to.

Some of the files that you need to know when you are creating a new plugin are:

name
location
information

require_embedded.cpp

src/lua-wrap/
Mostlly for Android

plugin-callback.h

include/core_mbm/
Callback implementation for plugin
plugin-helper.h
user-data-lua.h
plugins/plugin-helper/

API to use inside of the plugin

class-identifier.h
class-identifier.cpp
include/core_mbm/

You should use L_USER_TYPE_PLUGIN
Or you can define your own

Note

For a complete example of a plugin with full Lua API documentation, see the steam plugin.

Important

Since Android 7.0, the system prevents apps from dynamically linking against non-NDK libraries.

Reference: https://developer.android.com/about/versions/nougat/android-7.0-changes.html#ndk

For this reason, it is specified the dependency libraries in Android build.

In our existent plugins, we specify some flags to include them…

if you want to use box2d in Android you must to include the flag -DUSE_BOX2D=1 when invoking Cmake.

More details in Android dependencies.

I recommend to do the same for your new plugins.