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-msvcto ensure the correct target is installed.
Creating/Building a Plugin
- Open a terminal and run
cargo new <project_name>, whereproject_nameis your desired name for the plugin. - Run
cd <project_name>, then runcodeto open Visual Studio Code. - Click on
cargo.tomland 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
.cargoright next tosrc. - Create a new file inside the
.cargofolder namedconfig.toml, and paste these lines into the file before then saving it: - Now rename the file
src/main.rstosrc/lib.rsand 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!