Skip to content

v5.5 #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 118 commits into from
Jun 26, 2025
Merged

v5.5 #223

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
d50f3ed
well that also works ig
bitten2up Dec 13, 2023
7494295
oops
bitten2up Dec 13, 2023
6a9e404
remove some documentation
bitten2up Dec 14, 2023
2ac057b
Merge old 5.1.0 commits into new 5.1.0 branch (#52)
IoIxD Jun 2, 2024
3efccc2
left some merge conflicts in by accident
IoIxD Jun 2, 2024
29cb99e
submodule bump
IoIxD Jun 2, 2024
b391151
Fix: `draw_mesh` receives reference instead of owned value
OrangethewellTest Jun 2, 2024
39f5a12
well that also works ig
bitten2up Dec 13, 2023
774560a
remove some documentation
bitten2up Dec 14, 2023
13b8c5e
Fix: `draw_mesh` receives reference instead of owned value
OrangethewellTest Jun 2, 2024
fac4086
Merge branch 'raylib-rs-5.1.0' into 5.1.0
OrangethewellTest Jun 2, 2024
f8a3fc2
fix conflicts
OrangethewellTest Jun 2, 2024
cd37940
Merge pull request #54 from orangethewell/5.1.0
IoIxD Jun 2, 2024
11112ee
Initial fixes to get 5.1 building
IoIxD Jun 2, 2024
256584c
get rid of the lint
IoIxD Jun 2, 2024
1056357
general: initial fixes to get 5.1 building.
IoIxD Jun 2, 2024
3716554
wrote a small python script to check what functions need to be implem…
IoIxD Jun 3, 2024
fed3cae
Merge branch '5.1.0' of github.com:raylib-rs/raylib-rs into 5.1.0
IoIxD Jun 3, 2024
ee6d42b
Add `isShaderReady()` wrapper #56
OrangethewellTest Jun 3, 2024
6172a7c
Add `GetShaderLocationAttrib()` wrapper
OrangethewellTest Jun 3, 2024
80205cf
Add `DrawCircleLinesV()` wrapper
OrangethewellTest Jun 3, 2024
c36dd4c
Add `DrawCubeWiresV()` wrapper
OrangethewellTest Jun 3, 2024
35d5811
Add `DrawCylinderEx()` wrapper
OrangethewellTest Jun 3, 2024
6127d2a
Add `DrawCylinderWiresEx()` wrapper
OrangethewellTest Jun 3, 2024
f0dfc56
Fix docs for `draw_rectangle_rounded_*` functions
OrangethewellTest Jun 3, 2024
d57f116
Fix `draw_circle_lines_v()` missing name
OrangethewellTest Jun 3, 2024
d8cc4d5
fix shader `is_ready` function name
OrangethewellTest Jun 5, 2024
0dd73a0
all: added basic functions
IoIxD Jun 6, 2024
1774f9c
drawing: accidentally had draw_capsule_wires call DrawCapsule
IoIxD Jun 6, 2024
beafa78
audio: oh, we don't drop sound alias
IoIxD Jun 6, 2024
ad0dccf
Fix update_camera_pro
fooeyround Jun 6, 2024
c251dde
Rework callback system to use atomic instead of Mutex.
TSnake41 Jul 6, 2024
dfd1ae0
Relax &mut self requirements on Audio types
Kacper-Kondracki Jul 22, 2024
6643a54
feat(error)!: add designated error type
alexmozaidze Jul 7, 2024
aa6f971
fix matrix rotation on axis
computermouth Aug 9, 2024
f799b09
Replaced `naglebra_interop` with `convert_mint` feature.
nikhilr612 Aug 4, 2024
3d4d52d
Merge branch 'master' into 5.1.0
IoIxD Aug 16, 2024
38b61df
Merge pull request #76 from raylib-rs/5.1.0
IoIxD Aug 16, 2024
4b1da95
readme: fixed readme
IoIxD Aug 16, 2024
172810a
Implementing DerefMut for most RaylibDrawHandle Modes
Mathys-Gasnier Aug 16, 2024
5ff0261
Merge pull request #77 from Mathys-Gasnier/5.1.0
IoIxD Aug 16, 2024
20370d9
Merge branch 'deltaphc:master' into 5.1.0
IoIxD Aug 20, 2024
722d632
Merge pull request #79 from raylib-rs/5.1.0
IoIxD Aug 20, 2024
2eafc33
Merge the changes just made to stable back into unstable (#82)
IoIxD Aug 21, 2024
dd266a4
Added more 5.5 functions (#78)
IoIxD Aug 21, 2024
a170cee
Add closure equivalants to the begin_... functions (#84)
IoIxD Sep 16, 2024
f9f435d
fix: fix build on arm (#88)
theoparis Oct 24, 2024
0f239c9
Routine 5.5 update (#91)
IoIxD Oct 24, 2024
e831eab
remove double &mut (#61)
NewGirlJade Oct 24, 2024
0c8d134
unremove the file module (#92)
IoIxD Oct 24, 2024
17142a6
remove unused dependencies (#94)
jestarray Oct 27, 2024
3592c29
partial android support (#98)
jestarray Oct 29, 2024
230012a
make raylib-sys/raylib submodule shallow (#99)
jestarray Oct 31, 2024
a2e4125
make sure gles2 links to needed libs and added gles3 (#100)
jestarray Nov 2, 2024
8683f0a
added desktop sdl backend support (#101)
jestarray Nov 3, 2024
6545445
[general] bumped submodule to 5.5
IoIxD Dec 2, 2024
19dcfd1
Rest of 5.5 (#103)
IoIxD Dec 2, 2024
cae1e5d
[build] we will not be getting better wasm compilation after all (#105)
IoIxD Dec 3, 2024
181e473
[readme] version bump, remove outdated "future changes" section, move…
IoIxD Dec 3, 2024
64a16f9
[find_unimplemented] raygui functions
IoIxD Dec 3, 2024
2491aee
[raygui] Remove IntoCStr, add a few more functions.
IoIxD Dec 3, 2024
9446281
[raygui] we can bind GuiColorBarHue safely as it's a pointer to a float
IoIxD Dec 3, 2024
93d7990
Merge branch 'unstable' into rgui-fix
IoIxD Dec 3, 2024
7d70bc6
Decouple the callback functions from RaylibHandle, allowing them to u…
IoIxD Dec 6, 2024
943b819
add new constructor function for Ray (#109)
Dec 18, 2024
b0d1f9a
rlImGui bindings (#107)
IoIxD Dec 25, 2024
2860541
[samples] working rgui example
IoIxD Dec 28, 2024
25e817a
[rgui] enforce usage of GuiProperty enums
IoIxD Dec 28, 2024
2f34c5e
Merge branch 'unstable' into rgui-fix
IoIxD Dec 28, 2024
ded9b79
[rgui] impl Into<String> -> &str
IoIxD Dec 28, 2024
aae1d32
[imgui] accidentally left an import in mod.rs that errors if imgui fe…
IoIxD Dec 29, 2024
ba1f5d9
Rework gui_list_view_ex.
TSnake41 Dec 30, 2024
6d0d128
Various examples fixes (#115)
TSnake41 Dec 30, 2024
7654752
Audio improvements (#116)
TSnake41 Jan 22, 2025
68dd743
Merge pull request #106 from IoIxD/rgui-fix
TSnake41 Jan 22, 2025
9ac3acf
feat: add nixos shell.nix and docs for it (#123)
JamesKEbert Feb 6, 2025
fbe882a
added back nobuild because removing it was stupid why did i do that w…
IoIxD Feb 14, 2025
34f21f6
Put specs behind feature (#125)
izzymg Feb 14, 2025
2fd6fcd
Expanded nobuild flag (#127)
IoIxD Feb 15, 2025
eca46e2
Added binding for SetAudioStreamBufferSizeDefault(int) (#128)
Barysk Mar 17, 2025
317a0b5
attach_audio_stream_processor_to_music: attach one or more closures a…
goto40 Mar 17, 2025
d952343
Assorted 5.5 fixes (#132)
IoIxD Mar 21, 2025
a725c30
[raylib-test] remove set_file_text_loader (#134)
IoIxD Mar 21, 2025
789ede0
[raylib-sys] bindgen feature should be default oops (#136)
IoIxD Mar 21, 2025
fba491e
Imgui bindings are only called when imgui feature is enabled (#142)
AustinOliverHaskell Mar 25, 2025
91bcb49
Version bump to 5.5.1 so that I can publish the MacOS fix (#145)
IoIxD Mar 30, 2025
bdc64b2
Change get_mouse_wheel_move_v return type (#139)
AmityWilder Mar 30, 2025
0a9e8b2
Move check_collision_circle_line out of Rectangle impl (#149)
AmityWilder Apr 2, 2025
95234d1
[rgui] gui_panel handles empty str (#150)
jgabaut Apr 2, 2025
aadf1a7
Fix double-end-draw bug (#152)
AmityWilder Apr 2, 2025
cb0c004
Fix update_texture_rec precondition (#153)
AmityWilder Apr 2, 2025
ac948ce
Fix documentation mistake (#154)
AmityWilder Apr 2, 2025
4ef4837
Implement `DataBuf` structure (#155)
AmityWilder Apr 3, 2025
bd8b94d
fix: Image::get_color should not require mut (#157)
edvinsternvik Apr 6, 2025
d830925
[readme] remove mention of physac (#151)
IoIxD Apr 6, 2025
0bb5495
Move `.as_ptr()` so its return doesn't dangle (#163)
AmityWilder Apr 9, 2025
86dfff7
Remove dependency on cfg-if (#159)
AmityWilder Apr 9, 2025
25f6790
Simplify Serde `use` statements in `color.rs` and `window.rs` (#161)
AmityWilder Apr 9, 2025
a3d13c1
Make draw modes slightly more versatile (#165)
AmityWilder Apr 9, 2025
85d67ce
Remove redundant camera argument (#167)
AmityWilder Apr 9, 2025
e6f7a59
Get `load_shader` and `load_shader_from_memory` working with Option e…
AmityWilder Apr 10, 2025
927dccd
Implement lazy iterators (#171)
AmityWilder Apr 12, 2025
7ed5adb
Fix inconsistencies in documentation/attributes/function inclusion (#…
AmityWilder Apr 12, 2025
4d53bd4
Fix lifetime mistake (#176)
AmityWilder Apr 12, 2025
93dde6b
Better errors (#173)
AmityWilder Apr 12, 2025
0bfa274
Added snake game sample (#111)
largenumberhere May 11, 2025
ccc0827
Fix UAF on load_model_animations (#182)
Bqrry4 May 11, 2025
e41f9d8
added rcamera functions into core::camera (#185)
computermouth May 21, 2025
dac9060
Massive custom build system overhaul, Bump version 5.5.2, Upgrade rus…
jestarray May 25, 2025
3b5da73
[build] oops we still wanna build the utils_log stuff (#189)
IoIxD May 25, 2025
6c430d7
[meta] change version number 5.5.2 to 5.6 (#190)
IoIxD May 25, 2025
66cb8ec
[meta] 5.6 -> 5.6.0 (#191)
IoIxD May 25, 2025
441c0d0
5.7.0: Replace ffi::Vectors with Mint and safe binding Vectors with g…
jestarray Jun 1, 2025
e2be94b
fixed raygui textbox not being able to take input (#195)
jestarray Jun 2, 2025
c7227f6
rgui: gui_color_picker now mutates color like the ffi one (#196)
jestarray Jun 3, 2025
f97ceec
Change font-loading methods to use codepoint count instead of byte count
AmityWilder Jun 10, 2025
a39508e
Merge pull request #202 from AmityWilder/byte_count-codepoint_count
AmityWilder Jun 24, 2025
33b4844
Fix screen height typo. (Fixes: #198) (#206)
MohammedKHC0 Jun 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 6 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -26,31 +26,7 @@ jobs:
run: git submodule init; git submodule update
- name: Install alsa, udev, glfw3, sdl, and wayland
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libglfw3-dev libwayland-dev libsdl2-dev
- name: Run doc tests with all features (this also compiles README examples)
run: cargo test --doc --all-features
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Setup git submodules
run: git submodule init; git submodule update
- name: Install alsa, udev, glfw3, sdl, and wayland
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libglfw3-dev libwayland-dev libsdl2-dev
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features
- name: Check format
run: cargo fmt --all -- --check
- name: Clone latest GLFW3
run: git clone https://github.com/glfw/glfw; cd glfw; mkdir build; cd build; cmake ..; make -j$(nproc); sudo make install; cd ../..;
- name: Run doc tests (this also compiles README examples)
run: cargo test --doc
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/target
target
**/*.rs.bk
Cargo.lock
/.vscode
Expand Down
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[submodule "raylib-sys/raylib"]
path = raylib-sys/raylib
url = https://github.com/raysan5/raylib
commit = "5.5"
shallow = true
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# raylib-rs Changelog

## 3.7.0 (WIP)
## 5.7.0
- More improved ergonomics
- REFACTOR: Everything that interfaces with `raylib-sys` **has to use mint vectors** because as it has the most common supported interface type in the rust ecosystem. (tl;dr Replaced `ffi::Vectors -> mint::Vectors`)
- REFACTOR: Everything that interfaces with raylib safe bindings will often **take as input mint vectors but output/store glam-rs vectors**(storing them in Camera, Mesh, Boundingbox, etc), This can easily be swapped out. (tl;dr Replaced: `math::core::Vectors -> glam::Vectors`. glam Matrix and Quat however are incompatible so these stay as is)
- BREAKING: Code that uses `Vector4` constructors break, instead use `Vector4::new()
- REFACTOR: `Camera3D` ported methods in favor of calling ffi for easier maintenance reasons
- REFACTOR: trace_log from needing to be on the RaylibHandle and take &self
- MOVED: `color.rs` to `raylib-sys` because having 2 versions of this simple structure is pointless
- MOVED: `Rectangle` to `raylib-sys` because having 2 versions of this simple structure is pointless
- REMOVED: needless `target_os = windows` for rlgl getting&setting matrix functions
- BUGFIX : `build.rs` gen_utils function generated the `util_log.c` as `rgui`making raygui not work
- Removed: Removed imgui from being a feature on `raylib-sys`, instead check [imgui example](https://github.com/raylib-rs/raylib-rs/blob/unstable/samples/imgui.rs) for integration
## build script changes:
- Blacklist Vector2, Vector3, Vector4, Matrix, Quaternion, Rectangle, Color from generating in bindgen as they are replaced by mint and manual implementations
- BUGFIX: Fixed bug where `utils_log` compiled as "rgui" making the rust build fail in some cases
- Prevent android builds from turning on GLFW flags
- Added/exposed various feature flags
- Invert `bindgen` feature flag to `nobindgen` since its a more saner default


## 3.7.0

- [core] ADDED: LoadVrStereoConfig()
- [core] ADDED: UnloadVrStereoConfig()
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[workspace]
members = ["raylib", "raylib-sys"]
exclude = ["raylib-test", "samples"]
resolver = "2"
150 changes: 61 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
<p align="center">

![rust](https://img.shields.io/badge/rust-1.77+-orange.svg?style=flat-square&logo=rust)
[![crates.io](https://img.shields.io/crates/v/raylib.svg?style=flat-square)](https://crates.io/crates/raylib)
[![docs](https://docs.rs/raylib/badge.svg)](https://docs.rs/raylib)
[![discord](https://img.shields.io/discord/426912293134270465)](https://discord.gg/VkzNHUE)

</p>

<table border="0">
<tr>
<td>
Expand All @@ -18,7 +9,7 @@

# raylib-rs

raylib-rs is a Rust binding for [raylib](http://www.raylib.com/) 5.0. It currently targets the _stable_ Rust toolchain, version 1.78 or higher.
raylib-rs is a Rust binding for [raylib](http://www.raylib.com/) **5.5**. It currently targets Rust toolchain version 1.78 or higher.

Please checkout the showcase directory to find usage examples!

Expand All @@ -30,36 +21,28 @@ Though this binding tries to stay close to the simple C API, it makes some chang

Most development happens over at: https://github.com/raylib-rs/raylib-rs


- Resources are automatically cleaned up when they go out of scope (or when `std::mem::drop` is called). This is essentially RAII. This means that "Unload" functions are not exposed (and not necessary unless you obtain a `Weak` resource using make_weak()).
- Most of the Raylib API is exposed through `RaylibHandle`, which is for enforcing that Raylib is only initialized once, and for making sure the window is closed properly. RaylibHandle has no size and goes away at compile time. Because of mutability rules, Raylib-rs is thread safe!
- A `RaylibHandle` and `RaylibThread` are obtained through `raylib::init_window(...)` or through the newer `init()` function which will allow you to `build` up some window options before initialization (replaces `set_config_flags`). RaylibThread should not be sent to any other threads, or used in a any syncronization primitives (Mutex, Arc) etc.
- Manually closing the window is unnecessary, because `CloseWindow` is automatically called when `RaylibHandle` goes out of scope.
- `Model::set_material`, `Material::set_shader`, and `MaterialMap::set_texture` methods were added since one cannot set the fields directly. Also enforces correct ownership semantics.
- `Font::from_data`, `Font::set_chars`, and `Font::set_texture` methods were added to create a `Font` from loaded `CharInfo` data.
- `SubText` and `FormatText` are omitted, and are instead covered by Rust's string slicing and Rust's `format!` macro, respectively.
Versions normally match Raylib's own, with the minor number incremented for any patches (i.e. 5.5.1 for Raylib v5.5). On occassion, if enough breaking changes are made in between Raylib releases, we'll release a 5.6, which is 5.5 but with breaking changes.

# Installation

## Supported Platforms

| API | Windows | Linux | macOS | Web | Android |
| ------ | ------------------ | ------------------ | ------------------ | -------------- | ------- |
| core | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |
| rgui | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ❔ | :x: |
| physac | :construction: | :construction: | :construction: | ❔ | :x: |
| rlgl | :heavy_check_mark: | :x: | :x: | ❔ | :x: |
| API | Windows | Linux | macOS | Web | Android |
| ---- | ------------------ | ------------------ | ------------------ | ------------------ | ------- |
| core | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |
| rgui | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ❔ | :x: |
| rlgl | :heavy_check_mark: | :x: | :x: | ❔ | :x: |

## Build Dependencies

Requires glfw, cmake, and curl. Tips on making things work smoothly on all platforms is appreciated.
Requires `glfw`, `cmake`, and `curl`. Tips on making things work smoothly on all platforms is appreciated.
Follow instructions for building raylib for your platform [here](https://github.com/raysan5/raylib/wiki)

1. Add the dependency to your `Cargo.toml`:

```toml
[dependencies]
raylib = { version = "5.0" }
raylib = { version = "5.7.0", features = [] }
```

2. Start coding!
Expand All @@ -82,15 +65,17 @@ fn main() {
}
```

# Tech Notes
### NixOS

- Structs holding resources have RAII/move semantics, including: `Image`, `Texture2D`, `RenderTexture2D`, `Font`, `Mesh`, `Shader`, `Material`, and `Model`.
- `Wave`, `Sound`, `Music`, and `AudioStream` have lifetimes bound to `AudioHandle`.
- Functions dealing with string data take in `&str` and/or return an owned `String`, for the sake of safety. The exception to this is the gui draw functions which take &CStr to avoid per frame allocations. The `rstr!` macro helps make this easy.
- In C, `LoadFontData` returns a pointer to a heap-allocated array of `CharInfo` structs. In this Rust binding, said array is copied into an owned `Vec<CharInfo>`, the original data is freed, and the owned Vec is returned.
- In C, `LoadDroppedFiles` returns a pointer to an array of strings owned by raylib. Again, for safety and also ease of use, this binding copies said array into a `Vec<String>` which is returned to the caller.
- I've tried to make linking automatic, though I've only tested on Windows 10, Ubuntu, and MacOS 15. Other platforms may have other considerations.
- OpenGL 3.3, 2.1, and ES 2.0 may be forced via adding `["opengl_33"]`, `["opengl_21"]` or `["opengl_es_20]` to the `features` array in your Cargo.toml dependency definition.
To use raylib-rs on NixOS there's a provided nix-shell file `shell.nix` at the root of the repo that should get you up and running, which can be used like so:

`nix-shell ./shell.nix`

You'll also need to enable the Wayland feature on the raylib crate:

`cargo add raylib -F wayland`

Contributions are welcome to improve or fix the shell.nix!

## Building from source

Expand All @@ -100,78 +85,65 @@ fn main() {
### If building for Wayland on Linux

3. Install these packages:
`libglfw3-dev wayland-devel libxkbcommon-devel wayland-protocols wayland-protocols-devel libecm-dev`
`libglfw3-dev wayland-devel libxkbcommon-devel wayland-protocols wayland-protocols-devel libecm-dev`

###### Note that this may not be a comprehensive list, please add details for your distribution or expand on these packages if you believe this to be incomplete.

4. Enable wayland by adding `features=["wayland"]` to your dependency definition

## Cross-compiling using `cross`

The [@rust-embedded](https://github.com/rust-embedded) project provides a handy tool called [`cross`](https://github.com/rust-embedded/cross) that uses docker to cross-compile any cargo project to one of their many [supported platforms](https://github.com/rust-embedded/cross#supported-targets). This tool makes it easy to cross-compile `raylib-rs` for binary distribution (in cases where you are producing a pre-compiled game for example).

### Anything to Windows

Cross-compiling from other platforms to Windows is the simplest. Just build your project with this command instead of the usual `cargo build`:

```sh
cross build --target x86_64-pc-windows-gnu --release
```

It should be noted that the resulting exe will likely not run under `wine` due to an issue with Raylib's audio handling.

### Anything to Linux

Cross-compiling from any platform to Linux, or from Linux to Linux requires a little extra work since `raylib-sys` has some system dependencies not provided by `cross`. This following example assumes you are compiling for `x86_64-unknown-linux-gnu`, but it can be any Linux-y triple.

Firstly, a custom build container must be defined. The following `Dockerfile` is the minimum setup for compiling `raylib-sys`:
Cross compiling with raylib-rs can be made easier with cross. [See more on the wiki](https://github.com/raylib-rs/raylib-rs/wiki/Cross%E2%80%90compiling-using-cross)

```Dockerfile
FROM rustembedded/cross:x86_64-unknown-linux-gnu-0.2.1
## Running Examples
1. `cd samples`
2. `cargo run --bin 3d_camera_first_person`

RUN apt-get update -y
RUN apt-get install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev -y
```

With the image defined, build it locally with:

```sh
docker build -t raylib_rs_env .
```

This will produce a local docker image called `raylib_rs_env` which `cross` will use instead of the default Linux image(s). To tell `cross` to use this image, create a `Cross.toml` file beside your `Cargo.toml`, and add the following (remembering to change things to suit your setup):

```toml
[target.x86_64-unknown-linux-gnu]
image = "raylib_rs_env"
```

The Linux build can now be produced with:

```sh
cross build --target x86_64-unknown-linux-gnu --release
# Extras
- See [the wiki](https://github.com/raylib-rs/raylib-rs/wiki) for more info
- Raylib has tons of features that are **not included by default**, such as support for various file formats like JPG, etc. We match raylibs default build configuration but this can be customized by enabling and disabling [feature flags](https://github.com/raylib-rs/raylib-rs/blob/unstable/raylib/Cargo.toml)
- For a leaner custom build of raylib, set `default-features = false`, **but beware** that there are mandatory flags that when compiled without will break raylib(such as `SUPPORT_STANDARD_FILEIO`)
- See how to integrate dearimgui into your project in [samples/imgui.rs](https://github.com/raylib-rs/raylib-rs/blob/unstable/samples/imgui.rs)

# Contributing checklist:
- [ ] Run `cargo test` and `cargo test --doc` while in `raylib` safe bindings directory and make sure no tests fail
- [ ] Test on major platforms (windows, linux)
- [ ] Run examples: `cd samples` and `cargo run --bin <sample_name>`
- [ ] Find & replace the version numbers in every Cargo.toml "5.6.x" -> "5.6.x"
- [ ] Update the changelog
- [ ] Keep a lookout on tagging functions with `#[inline]` , `#[must_use]` , and `const`

### Updating raygui:
The `raygui.h` file has to have this ifdef modified to point to where `raylib.h` is:
```c
#if !defined(RAYGUI_STANDALONE)
#include "../raylib/src/raylib.h"
#endif
```

# MacOS / Darwin / IOS

`cross` does not support cross-compilation to any of Apple's operating systems as of now. Keep an eye on their repository in case this ever changes.
# Safe Binding characteristics
- Resources are automatically cleaned up when they go out of scope (or when `std::mem::drop` is called). This is essentially RAII. This means that "Unload" functions are not exposed (and not necessary unless you obtain a `Weak` resource using make_weak()).
- Most of the Raylib API is exposed through `RaylibHandle`, which is for enforcing that Raylib is only initialized once, and for making sure the window is closed properly. RaylibHandle has no size and goes away at compile time. Because of mutability rules, Raylib-rs is thread safe!
- A `RaylibHandle` and `RaylibThread` are obtained through `raylib::init_window(...)` or through the newer `init()` function which will allow you to `build` up some window options before initialization (replaces `set_config_flags`). RaylibThread should not be sent to any other threads, or used in a any syncronization primitives (Mutex, Arc) etc.
- Manually closing the window is unnecessary, because `CloseWindow` is automatically called when `RaylibHandle` goes out of scope.
- `Model::set_material`, `Material::set_shader`, and `MaterialMap::set_texture` methods were added since one cannot set the fields directly. Also enforces correct ownership semantics.
- `Font::from_data`, `Font::set_chars`, and `Font::set_texture` methods were added to create a `Font` from loaded `CharInfo` data.
- `SubText` and `FormatText` are omitted, and are instead covered by Rust's string slicing and Rust's `format!` macro, respectively.

# Extras
# Tech Notes

- In addition to the base library, there is also a convenient `ease` module which contains various interpolation/easing functions ported from raylib's `easings.h`, as well as a `Tween` struct to assist in using these functions.
- Equivalent math and vector operations, ported from `raymath.h`, are `impl`ed on the various Vector and Matrix types. Operator overloading is used for more intuitive design.
- Structs holding resources have RAII/move semantics, including: `Image`, `Texture2D`, `RenderTexture2D`, `Font`, `Mesh`, `Shader`, `Material`, and `Model`.
- `Wave`, `Sound`, `Music`, and `AudioStream` have lifetimes bound to `AudioHandle`.
- Functions dealing with string data take in `&str` and/or return an owned `String`, for the sake of safety. The exception to this is the gui draw functions which take &CStr to avoid per frame allocations. The `rstr!` macro helps make this easy.
- In C, `LoadFontData` returns a pointer to a heap-allocated array of `CharInfo` structs. In this Rust binding, said array is copied into an owned `Vec<CharInfo>`, the original data is freed, and the owned Vec is returned.
- In C, `LoadDroppedFiles` returns a pointer to an array of strings owned by raylib. Again, for safety and also ease of use, this binding copies said array into a `Vec<String>` which is returned to the caller.
- I've tried to make linking automatic, though I've only tested on Windows 10, Ubuntu, and MacOS 15. Other platforms may have other considerations.
- OpenGL 3.3, 2.1, and ES 2.0 may be forced via adding `["opengl_33"]`, `["opengl_21"]` or `["opengl_es_20]` to the `features` array in your Cargo.toml dependency definition.

# Testing

The raylib-test crate tests the bindings by opening a window, and checking the results of various functions. It requires nightly to use.

# Future Goals

- Port raylib examples over to Rust.
- More tests.
- More platform testing.
- Even more testing.
- Physac port?

# Contribution & Support

All contributions are welcome. Chat about raylib on [discord](https://discord.gg/VkzNHUE)
Loading