Skip to content

cpdt/rrplug

 
 

Repository files navigation

rrplug

crate that provides function wappers and functions for R2Northstar plugin creation.

Plugin Support

the v1 branch is for v1 plugins

the v2 branch is for v2 plugins

the master branch is the newest version

Getting Started

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

rrplug template

install cargo-generate if you don't have it

cargo install cargo-generate
cargo generate -g  https://github.com/catornot/rrplug.git

About

rust crate for R2Northstar plugins

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.9%
  • C 0.1%