classicube-sys
Rust bindings to ClassiCube
Documentation
Example
Add this to Cargo.toml:
[lib]
crate-type = ["cdylib"]
[dependencies]
classicube-sys = { git = "https://github.com/SpiralP/rust-classicube-sys.git" }
lib.rs:
use classicube_sys::*;
use std::{os::raw::c_int, ptr};
extern "C" fn init() {
let owned_string = OwnedString::new("hello from rust!");
unsafe {
Chat_Add(owned_string.as_cc_string());
}
}
#[unsafe(no_mangle)]
pub static Plugin_ApiVersion: c_int = 1;
#[unsafe(no_mangle)]
pub static mut Plugin_Component: IGameComponent = IGameComponent {
Init: Some(init),
Free: None,
Reset: None,
OnNewMap: None,
OnNewMapLoaded: None,
next: ptr::null_mut(),
};
Copy the .dll/.so/.dylib from target/{debug,release}/ to the plugins folder where your ClassiCube executable is found
References
Example library usage
ClassiCube source
ClassiCube Plugin help
ClassiCube Plugin examples