mirror of
https://github.com/obsqrbtz/egui_knob.git
synced 2026-04-08 20:19:17 +03:00
chore: bump egui, docs: update example
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.3.4] - 2025-07-15
|
||||||
|
|
||||||
|
### 🛠 Maintenance
|
||||||
|
|
||||||
|
- Bump egui version to 0.33
|
||||||
|
|
||||||
|
### 📚 Documentation
|
||||||
|
|
||||||
|
- Updated usage example in readme
|
||||||
|
|
||||||
|
|
||||||
## [0.3.1] - 2025-07-15
|
## [0.3.1] - 2025-07-15
|
||||||
|
|
||||||
### 🚀 Features
|
### 🚀 Features
|
||||||
|
|||||||
1069
Cargo.lock
generated
1069
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "egui_knob"
|
name = "egui_knob"
|
||||||
version = "0.3.3"
|
version = "0.3.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A simple knob widget for egui"
|
description = "A simple knob widget for egui"
|
||||||
homepage = "https://github.com/obsqrbtz/egui_knob"
|
homepage = "https://github.com/obsqrbtz/egui_knob"
|
||||||
@@ -19,7 +19,7 @@ name = "example_knob"
|
|||||||
path = "examples/example_knob.rs"
|
path = "examples/example_knob.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
egui = "0.32"
|
egui = "0.33"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
eframe = { version = "0.32.0", features = ["default_fonts"] }
|
eframe = { version = "0.33", features = ["default_fonts"] }
|
||||||
|
|||||||
46
README.md
46
README.md
@@ -27,20 +27,40 @@ egui_knob = "0.3.3"
|
|||||||
## Usage example
|
## Usage example
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use egui::{Color32, Context};
|
use egui_knob::{Knob, KnobStyle, LabelPosition};
|
||||||
use egui_knob::Knob;
|
use eframe::{egui};
|
||||||
|
|
||||||
// ..
|
struct KnobApp {
|
||||||
|
value: f32,
|
||||||
|
}
|
||||||
|
|
||||||
let mut value: f32 = 0.5;
|
impl Default for KnobApp {
|
||||||
let knob = Knob::new(&mut value, 0.0, 1.0, KnobStyle::Wiper)
|
fn default() -> Self {
|
||||||
.with_size(50.0)
|
Self { value: 0.5 }
|
||||||
.with_font_size(14.0)
|
}
|
||||||
.with_stroke_width(3.0)
|
}
|
||||||
.with_colors(Color32::GRAY, Color32::WHITE, Color32::WHITE)
|
|
||||||
.with_label("Volume", LabelPosition::Top);
|
|
||||||
|
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
impl eframe::App for KnobApp {
|
||||||
ui.add(knob);
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||||
});
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
|
let knob = Knob::new(&mut self.value, 0.0, 1.0, KnobStyle::Wiper)
|
||||||
|
.with_size(50.0)
|
||||||
|
.with_font_size(14.0)
|
||||||
|
.with_colors(egui::Color32::GRAY, egui::Color32::WHITE, egui::Color32::WHITE)
|
||||||
|
.with_stroke_width(3.0)
|
||||||
|
.with_label("Volume", LabelPosition::Top);
|
||||||
|
|
||||||
|
ui.add(knob);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let options = eframe::NativeOptions::default();
|
||||||
|
eframe::run_native(
|
||||||
|
"Minimal",
|
||||||
|
options,
|
||||||
|
Box::new(|_cc| Ok(Box::new(KnobApp::default()) as Box<dyn eframe::App>)),
|
||||||
|
).unwrap();
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ impl Default for KnobDemo {
|
|||||||
impl eframe::App for KnobDemo {
|
impl eframe::App for KnobDemo {
|
||||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
ui.heading("🎛 egui-knob example");
|
ui.heading("egui-knob example");
|
||||||
ui.separator();
|
ui.separator();
|
||||||
|
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
|
|||||||
Reference in New Issue
Block a user