1
raylib-ffi/examples/basic.rs
2022-12-09 13:05:28 -05:00

39 lines
1.0 KiB
Rust

use renderkit::raylib::window::Window;
pub fn main() {
unsafe {
// Set up logging
env_logger::init();
// Create a window
let window = Window::new(
cgmath::Vector2::new(800, 450),
"renderkit example - basic window",
);
// Render the window
loop {
// Close the window if requested
if renderkit::raylib::ffi::WindowShouldClose() {
break;
}
// Begin a draw call
renderkit::raylib::ffi::BeginDrawing();
// Render text and a background
renderkit::raylib::ffi::ClearBackground(renderkit::raylib::palette::RAYWHITE.into());
renderkit::raylib::ffi::DrawText(
cstr::cstr!("Congrats! You created your first window!").as_ptr(),
190,
200,
20,
renderkit::raylib::palette::BLACK.into(),
);
// End the draw call
renderkit::raylib::ffi::EndDrawing();
}
}
}