A Rust integration for GameMaker.
The rust directory contains all the Rust code that makes PNRust possible. It is comprised of the following subtrees:
- modules, the directory where all your PNRust modules are stored.
- pn-rust, a crate shared by all PNRust modules.
- pn_rust_dll, a DLL that powers PNRust.
- generate-dll, a binary that generates the glue that holds the module system together.
First of all, you need to copy rs_build.bat, rust, the PNRust
extension, and the pn_rust
script to your game folder. Use "Add existing" for the latter two.
Before you can use PNRust, you need to call rs_init
somewhere in your game's code.
After that, create a new module in rust/modules. Check out the example module for more info.
Once you make any changes to the Rust code, run rs_build.bat. You should run it inside an open command prompt to see any build errors.
See the next section to learn how to install the necessary Rust build tools.
GML example:
rs_init()
// Assuming you've exported `my_function` from, e.g., `my_great_module`.
var result = rs_call("my_function", [69])
show_debug_message("my_function: " + string(result))
First, you need to install rustup. Get the stable branch and add it to your PATH.
After that, install the stable-i686-pc-windows-gnu
toolchain by running this inside a command prompt:
rustup toolchain install stable-i686-pc-windows-gnu --profile minimal