Writing a Library plugin
Library plugins allow you to extend the library in OpenGamepadUI, offering ways to install and launch games and applications. Library plugins extend and implement the Library class. You can also look at the built-in Desktop Library implementation for an example of how to write a library plugin.
In this tutorial, we'll be writing a simple library plugin that will add
a new item to our library that will launch the vkcube test program.
First, start off by cloning a fork of the plugin
template
and filling out plugin.json. Then let's create a scene and script for
our new library:
OpenGamepadUI-vkcube
├── core
│ ├── library.gd
│ └── library.tscn # (1)
├── Makefile
├── plugin.gd
├── plugin.json
└── README.md
- This is the scene file
With our new library scene, edit the script and implement the
get_library_launch_items method to return a list of library items:
Now in our entrypoint script, load our new library scene and add it as a child of the plugin.
| plugin.gd | |
|---|---|
That's it! When your plugin gets loaded, your new library will automatically get registered with the library manager and games that your library provides will show up in your library!
Run make install to install your new plugin and test it out!