mirror of
https://github.com/csd4ni3l/soundboard.git
synced 2026-01-01 04:23:45 +01:00
Add bevy_egui and use example code from there, use mold for starter Rust linking and update README
This commit is contained in:
30
src/main.rs
30
src/main.rs
@@ -1,26 +1,22 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn spawn_camera(mut commands: Commands) {
|
||||
commands.spawn(Camera2d::default());
|
||||
}
|
||||
|
||||
pub fn setup(mut commands: Commands) {
|
||||
spawn_camera(commands);
|
||||
}
|
||||
|
||||
pub fn update(mut commands: Commands) {
|
||||
|
||||
}
|
||||
use bevy_egui::{egui, EguiContexts, EguiPlugin, EguiPrimaryContextPass};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, update)
|
||||
.add_plugins(EguiPlugin::default())
|
||||
.add_systems(Startup, setup_camera_system)
|
||||
.add_systems(EguiPrimaryContextPass, ui_example_system)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Person {
|
||||
pub name: String
|
||||
fn setup_camera_system(mut commands: Commands) {
|
||||
commands.spawn(Camera2d);
|
||||
}
|
||||
|
||||
fn ui_example_system(mut contexts: EguiContexts) -> Result {
|
||||
egui::Window::new("Hello").show(contexts.ctx_mut()?, |ui| {
|
||||
ui.label("world");
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user