4 个稳定版本
3.0.4+classicube.1.3.6 | 2024年7月4日 |
---|---|
3.0.3+classicube.1.3.6 | 2024年6月28日 |
3.0.2+classicube.1.3.6 | 2024年2月8日 |
3.0.1 | 2024年2月7日 |
555 在 开发工具 中排名
每月下载量 522 次
6MB
107K SLoC
包含 (JAR 文件,50KB) gradle-wrapper.jar
classicube-sys
Rust 对 ClassiCube 的绑定
示例
将以下内容添加到 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());
}
}
#[no_mangle]
pub static Plugin_ApiVersion: c_int = 1;
#[no_mangle]
pub static mut Plugin_Component: IGameComponent = IGameComponent {
// Called when the game is being loaded.
Init: Some(init),
// Called when the component is being freed. (e.g. due to game being closed)
Free: None,
// Called to reset the component's state. (e.g. reconnecting to server)
Reset: None,
// Called to update the component's state when the user begins loading a new map.
OnNewMap: None,
// Called to update the component's state when the user has finished loading a new map.
OnNewMapLoaded: None,
// Next component in linked list of components.
next: ptr::null_mut(),
};
将 .dll
/.so
/.dylib
从 target/{debug,release}/
复制到你的 ClassiCube 可执行文件所在的 plugins
文件夹