2 stable releases

3.0.2+classicube.1.3.6 Feb 8, 2024
3.0.1 Feb 7, 2024

#655 in Development tools

Download history 3/week @ 2024-02-04 6/week @ 2024-02-11 100/week @ 2024-02-18 95/week @ 2024-02-25 158/week @ 2024-03-03 64/week @ 2024-03-10 17/week @ 2024-03-17 1/week @ 2024-03-24 134/week @ 2024-03-31 6/week @ 2024-04-07 5/week @ 2024-04-14 18/week @ 2024-04-21 65/week @ 2024-04-28 49/week @ 2024-05-05

139 downloads per month

MIT license

6MB
107K SLoC

C 99K SLoC // 0.1% comments Rust 2.5K SLoC // 0.0% comments Objective-C 1.5K SLoC // 0.2% comments JavaScript 1K SLoC // 0.1% comments Java 827 SLoC // 0.2% comments C++ 598 SLoC // 0.1% comments Visual Studio Project 561 SLoC Shell 291 SLoC // 0.2% comments ReScript 84 SLoC Python 78 SLoC // 0.1% comments C# 74 SLoC Batch 66 SLoC Visual Studio Solution 43 SLoC

Contains (JAR file, 50KB) gradle-wrapper.jar

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());
    }
}

#[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(),
};

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

Dependencies