Creating a Plugin (Rust)
WARNING!!!! PENTANE'S API IS NOT STABLE SO ALL OF THIS IS SUBJECT TO CHANGE!!!!
Prerequisiste Software
- rustup
- Visual Studio Code
- git (For Version Control)
Installation
- Install Git (Follow the on-screen installer)
- Install rustup (Follow the instructions on the page)
- Install Visual Studio Code (Follow the on-screen installer)
- After the installation is complete, open a terminal and execute the following command:
rustup target add i686-pc-windows-msvc
to ensure the correct target is installed.
Creating/Building a Plugin
- Open a terminal and run
cargo new <project_name>
, whereproject_name
is your desired name for the plugin. - Run
cd <project_name>
, then runcode
to open Visual Studio Code. - Click on
cargo.toml
and add these lines to the bottom before then saving the file (Ctrl-S): - Right-click on the root of the project directory, and create a new folder named
.cargo
right next tosrc
. - Create a new file inside the
.cargo
folder namedconfig.toml
, and paste these lines into the file before then saving it: - Now rename the file
src/main.rs
tosrc/lib.rs
and open it. - Delete all contents and paste this template function in:
- Now open a terminal inside Visual Studio Code, and execute the following command
cargo build --release
- Navigate to your project folder via Windows Explorer, then follow the path
./target/i686-pc-windows-msvc/release/
to locate<project_name>.dll
. - Copy your newly compiled plugin to
Pentane/Plugins
. - Enable your plugin in
Pentane/config.toml
.
Congratulations! You have built your first plugin!