Crate classicube_sys
source ·Expand description
§classicube-sys
Rust bindings to ClassiCube
§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
Re-exports§
pub use crate::screen::OwnedScreen;
Modules§
Macros§
- gives ((x, y, z), (x1, y1, z1, x2, y2, z2))
- gives (x, y, z)
- gives (x, y, z)
- Whether all components of a 3D vector are 0
- Sets the x, y, and z components of a 3D vector
Structs§
Constants§
- Identity matrix. (A * Identity = A)
Statics§
Functions§
- Returns a vector with all components set to Int32_MaxValue.
- Gets the block at the nth index in the current hotbar.
- Gets the currently selected block.
- Sets the block at the nth index in the current hotbar.
- Safety
- Whether all of the components of the two vectors are equal.
- Returns a normalised vector facing in the direction described by the given yaw and pitch.
- Returns the squared length of the vector. Squared length can be used for comparison, to avoid a costly sqrt() However, you must sqrt() this when adding lengths.
- Linearly interpolates components of two vectors.
- Scales all components of a vector to lie in [-1, 1]
- Transforms a vector by the given matrix.
- Same as Vec3_Transform, but faster since x and z are assumed as 0.