| Crates.io | classicube-sys |
| lib.rs | classicube-sys |
| version | 4.3.0+ClassiCube.1.3.7 |
| created_at | 2024-02-07 23:15:45.551673+00 |
| updated_at | 2025-09-05 07:52:50.121168+00 |
| description | Rust C bindings for ClassiCube. |
| homepage | |
| repository | https://github.com/SpiralP/rust-classicube-sys |
| max_upload_size | |
| id | 1131079 |
| size | 16,670,144 |
Rust bindings to ClassiCube
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 {
// 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(),
};
Copy the .dll/.so/.dylib from target/{debug,release}/ to the plugins folder where your ClassiCube executable is found