#raylib #bevy #plugin #cursor #raylib-plugin

bevy_raylib

A very simple Raylib plugin for Bevy

2 releases

0.0.1 Oct 15, 2023
0.0.0 Oct 15, 2023

#24 in #raylib

MIT OR Apache-2.0 OR Zlib

13KB
77 lines

bevy_raylib

This is a very simple raylib plugin for bevy.

Usage

use bevy_app::prelude::*;
use bevy_ecs::prelude::*;
use bevy_raylib::prelude::*;
use bevy_utils::prelude::*;

fn main() {
  App::new()
    .add_plugins(RaylibPlugin)
    .insert_resource(WindowConfig {
      title: "Bevy + Raylib".to_owned(),
      ..default()
    })
    .add_systems(PostUpdate, render)
    .run();
}

fn render(mut raylib: NonSendMut<RaylibContext>, cursor: Res<Cursor>) {
  let mut d = raylib.begin_drawing();
  d.clear_background(Color::WHITE);
  d.draw_text(
    &format!("{}, {}", cursor.x, cursor.y),
    12,
    12,
    20,
    Color::BLACK,
  );
}

Dependencies

~12–20MB
~278K SLoC