[−][src]Crate raylib
raylib-rs
raylib is a safe Rust binding to Raylib, a C library for enjoying games programming.
To get started, take a look at the init_window function. This initializes Raylib and shows a window, and returns a RaylibHandle. This handle is very important, because it is the way in which one accesses the vast majority of Raylib's functionality. This means that it must not go out of scope until the game is ready to exit.
For more control over the game window, the init function will return a RaylibBuilder which allows for tweaking various settings such as VSync, anti-aliasing, fullscreen, and so on. Calling RaylibBuilder::build will then provide a RaylibHandle.
Some useful constants can be found in the consts module. In most cases you will probably want to use raylib::consts::*;.
Examples
The classic "Hello, world":
use raylib::consts::*; use raylib::Color; fn main() { let rl = raylib::init() .size(640, 480) .title("Hello, World") .build(); while !rl.window_should_close() { rl.begin_drawing(); rl.clear_background(Color::WHITE); rl.draw_text("Hello, world!", 12, 12, 20, Color::BLACK); rl.end_drawing(); } }
Modules
| consts | Common and useful constants for various kinds of functionality. |
| ease | Easing and interpolation helpers. |
Structs
| AudioStream | |
| BoundingBox | |
| Camera2D | |
| Camera3D | |
| CharInfo | |
| Color | |
| Font | |
| Gesture | |
| Image | |
| Log | |
| Material | |
| Matrix | |
| Mesh | |
| Model | |
| Music | |
| Ray | |
| RayHitInfo | |
| RaylibBuilder | A builder that allows more customization of the game window shown to the user before the |
| RaylibHandle | The main interface into the Raylib API. |
| Rectangle | |
| RenderTexture2D | |
| Shader | |
| Sound | |
| Texture2D | |
| Vector2 | |
| Vector3 | |
| Vector4 | |
| VrDeviceInfo | |
| Wave |
Enums
| BlendMode | |
| CameraMode | |
| CameraType | |
| PixelFormat | |
| ShaderLoc | |
| Texmap | |
| TextureFilter | |
| TextureWrap | |
| VrDevice |
Traits
| AudioSample | A marker trait specifying an audio sample ( |
| FontExt | An extension trait allowing for safe manipulation of |
| MaterialExt | An extension trait allowing for safe manipulation of |
| MaterialMapExt | An extension trait allowing for safe manipulation of |
| ModelExt | An extension trait allowing for safe manipulation of |
Functions
| init | Creates a |
| init_window | Initializes window and OpenGL context. |
| set_trace_log | Enables trace log message types (bit flags based). |
| trace_log | Writes a trace log message ( |
Type Definitions
| Quaternion |