crate that provides function wappers and functions for R2Northstar plugin creation.
the v1 branch is for v1 plugins
the v2 branch is for v2 plugins
the master branch is the newest version
add this to your Cargo.toml so your lib crate compiles into a dll.
[lib]
crate-type = ["cdylib"]create manifest.json with the following contents
{
"name": "plugin_name",
"displayname": "plugin_name",
"description": "plugin_name",
"api_version": "2",
"version": "1.0",
"run_on_server": false,
"run_on_client": true
}get Resource.rc and resource.h from NorthstarDiscordRPC.
create build.rs in the root of your project with the following content
extern crate windres;
use windres::Build;
fn main() {
Build::new().compile("manifest\\Resource.rc").unwrap();
}and add windres as a build dependencie.
Finnaly shove this into lib.rs
use rrplug::prelude::*;
pub struct BasicPlugin;
impl Plugin for BasicPlugin {
fn new() -> Self {
Self {}
}
fn initialize(&mut self, plugin_data: &PluginData) {
log::info!("yay logging :D");
}
fn main(&self) {}
}
entry!(BasicPlugin);Compile
Then Enjoy your hello world plugin
install cargo-generate if you don't have it
cargo install cargo-generatecargo generate -g https://github.com/catornot/rrplug.git