raylib_ffi/
macros.rs

1//! Quality of life macros 
2
3/// Begins drawing, creates a new scope, executes code, then cleans up
4/// 
5/// ## Example
6/// ```no_run
7/// # use raylib_ffi::draw;
8/// # fn main(){ unsafe {
9/// draw!({
10/// // Graphics code here..
11/// });
12/// # }}
13/// ```
14#[macro_export]
15macro_rules! draw {
16    ($expression:expr) => {
17        raylib_ffi::BeginDrawing();
18        {
19            $expression
20        }
21        raylib_ffi::EndDrawing();
22    };
23}
24
25/// Converts a string to `*const i8` for use with raylib
26#[macro_export]
27macro_rules! rl_str {
28    ($expression:expr) => {
29        format!("{}\0", $expression).as_ptr() as *const i8
30    };
31}