add readme and knob styles

This commit is contained in:
2025-02-03 12:31:20 +03:00
parent a484653f70
commit 413363370d
4 changed files with 72 additions and 23 deletions

40
README.md Normal file
View File

@@ -0,0 +1,40 @@
# Knob Widget
Simple knob widget for egui.
## Features
- Adjustable size, font size, and stroke width.
- Customizable colors for the knob and line.
- Label positions (Top, Bottom, Left, Right).
- Two styles: Wiper and Dot.
## Installation
To use the Knob widget in your project, add the following to your `Cargo.toml`:
```toml
[dependencies]
egui = "0.30"
```
## Usage example
```rust
use egui::{Color32, Context};
use egui_knob::Knob;
// ..
let mut value: f32 = 0.5;
let knob = Knob::new(&mut value, 0.0, 1.0, KnobStyle::Wiper)
.with_size(50.0)
.with_font_size(14.0)
.with_stroke_width(3.0)
.with_colors(Color32::GRAY, Color32::WHITE)
.with_label("Volume", LabelPosition::Top);
egui::CentralPanel::default().show(ctx, |ui| {
ui.add(knob);
});
```