1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* raylib-rs
lib.rs - Main library code (the safe layer)
Copyright (c) 2018-2024 raylib-rs team
This software is provided "as-is", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
//! Safe Rust bindings to raylib 6.0.
//!
//! This crate provides idiomatic Rust access to [raylib](https://www.raylib.com/)'s full feature
//! set: window management, 2D/3D drawing, input handling, raymath (vectors, matrices,
//! quaternions), audio playback, raygui immediate-mode UI, safe `rlgl` OpenGL abstractions, and a
//! headless software-renderer test harness — all without unsafe code in normal usage.
//!
//! ## Getting started
//!
//! Call [`init`] to obtain a [`RaylibBuilder`], configure it with chained methods, then call
//! [`RaylibBuilder::build`] to receive a `(RaylibHandle, RaylibThread)` pair. Everything in the
//! API hangs off [`RaylibHandle`]; keep it alive for the lifetime of your game loop. The
//! [`RaylibThread`] token is `!Send` and `!Sync` — it may only be used on the thread raylib was
//! initialised from.
//!
//! ## Feature gates
//!
//! - Math-crate integrations: `glam`, `mint`, `serde` (all opt-in, none default).
//! - `software_renderer` — wires the `rlsw` memory-platform backend for windowless/headless
//! rendering; exposes the `test_harness` module for pixel-probe tests. Mutually exclusive with
//! the `opengl_*` features.
//! - OpenGL back-end selection: `opengl_33` (default), `opengl_21`, `opengl_es_20`.
//! - Platform targets: `drm` (DRM/KMS tty, requires `opengl_es_20`), `wayland`.
//! - `full` — convenience alias enabling all optional API surface except back-end selectors.
//!
//! ## Examples
//!
//! The classic "Hello, world":
//!
//! ```no_run
//! use raylib::prelude::*;
//!
//! let (mut rl, thread) = raylib::init()
//! .size(640, 480)
//! .title("Hello, World")
//! .build();
//!
//! while !rl.window_should_close() {
//! let mut d = rl.begin_drawing(&thread);
//!
//! d.clear_background(Color::WHITE);
//! d.draw_text("Hello, world!", 12, 12, 20, Color::BLACK);
//! }
//! ```
//#![cfg_attr(feature = "nightly", feature(auto_traits))]
/// Safe, idiomatic wrappers over raylib's core subsystems — window, drawing, input, audio,
/// math, models, textures, shaders, text, files, and more.
///
/// Each submodule corresponds to one slice of raylib's C API: `window` wraps `InitWindow` /
/// `CloseWindow` and the per-frame query helpers, `drawing` provides the RAII guards
/// returned by `begin_drawing` / `begin_mode2d` / `begin_mode3d`, `audio` wraps the audio
/// device plus the `Wave`, `Sound`, `Music`, and `AudioStream` types, and so on. The
/// user-facing types (`RaylibHandle`, `RaylibThread`, `RaylibBuilder`, `Color`, `Image`,
/// `Texture2D`, ...) are re-exported by [`crate::prelude`] for the common case.
///
/// # See also
///
/// See the *Window and drawing* chapter of the book for the overall architecture and the
/// per-subsystem chapters for individual modules.
/// Headless software-render test harness (enabled by the `software_renderer` feature).
/// The raw, unsafe FFI binding, in case you need that escape hatch or the safe layer doesn't provide something you need.
pub use crate*;
/// Deprecated alias for [`ffi::Vector2`]; the public type is now the native `raylib-sys` type.
pub type MintVec2 = Vector2;
/// Deprecated alias for [`ffi::Vector3`].
pub type MintVec3 = Vector3;
/// Deprecated alias for [`ffi::Vector4`].
pub type MintVec4 = Vector4;
/// Deprecated alias for [`ffi::Matrix`].
pub type MintMatrix = Matrix;
/// Deprecated alias for [`ffi::Quaternion`].
pub type MintQuat = Quaternion;
pub use crate*;
pub use crateopen_url;
pub use crate*;
// Re-exports
pub use serde;