| Crates.io | rosu-renderer |
| lib.rs | rosu-renderer |
| version | 1.2.3 |
| created_at | 2025-07-12 17:38:18.021092+00 |
| updated_at | 2025-07-13 13:54:08.934198+00 |
| description | A library to render osu! beatmaps in egui |
| homepage | |
| repository | https://github.com/Glubus/rosu-renderer |
| max_upload_size | |
| id | 1749528 |
| size | 792,184 |
A Rust library for rendering osu! beatmaps using egui. Currently supports mania mode with customizable note styles and real-time playback.
Add this to your Cargo.toml:
[dependencies]
rosu-renderer = "1.1.1"
eframe = "0.32.0"
egui = "0.32.0"
egui_extras = { version = "0.32.0", features = ["image", "file"] }
rosu-map = "0.2.1"
use rosu_renderer::{Player, layout::mania::{NoteStyle, NoteShape}};
use rosu_map::Beatmap;
// Load your beatmap
let beatmap = Beatmap::from_path("path/to/your/map.osu").unwrap();
// Create a player with custom dimensions
let mut player = Player::new(beatmap, 80.0, 60.0, 800.0).unwrap();
// Customize note style
let style = NoteStyle {
shape: NoteShape::Circle,
color: egui::Color32::from_rgb(0, 174, 255),
hold_body_color: egui::Color32::from_rgb(200, 200, 200),
hold_cap_color: egui::Color32::from_rgb(0, 174, 255),
};
player.set_note_style(style);
// Set playback speed
player.set_speed(1.5);
// Set scroll speed (in milliseconds)
player.set_scroll_time(1000.0);
// In your egui app update loop:
player.render(ui);
// Or render at a specific position:
player.render_at(ui, egui::pos2(100.0, 50.0));
cargo run --example mania
The example provides a full-featured mania mode viewer with:
The main struct for rendering beatmaps.
pub struct Player {
// ... internal fields
}
impl Player {
// Create a new player instance
pub fn new(beatmap: Beatmap, column_width: f32, note_size: f32, height: f32) -> Option<Self>
// Set the note style
pub fn set_note_style(&mut self, style: NoteStyle)
// Get required window size
pub fn get_required_size(&self) -> [f32; 2]
// Set playback speed multiplier
pub fn set_speed(&mut self, speed: f64)
// Set scroll time in milliseconds
pub fn set_scroll_time(&mut self, ms: f32)
// Render the beatmap at position (0,0)
pub fn render(&mut self, ui: &mut egui::Ui)
// Render the beatmap at a specific position
pub fn render_at(&mut self, ui: &mut egui::Ui, position: egui::Pos2)
// Reset playback time
pub fn reset_time(&mut self)
// Set current playback time
pub fn set_current_time(&mut self, time_ms: f64)
// Get current playback time
pub fn current_time(&self) -> f64
}
Customize the appearance of notes.
pub struct NoteStyle {
pub shape: NoteShape,
pub color: Color32,
pub hold_body_color: Color32,
pub hold_cap_color: Color32,
}
pub enum NoteShape {
Circle,
Rectangle { width: f32, height: f32 },
Arrow { width: f32, height: f32 },
Image(egui::Image<'static>),
}
Currently, only osu!mania mode is supported. Support for other modes (Standard, Taiko, Catch) is planned for future releases.
cargo build
cargo test
# Run the mania example
cargo run --example mania
Contributions are welcome! Areas that need work:
This project is licensed under the MIT License - see the LICENSE file for details.