1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

Add Image::rotate and Mesh::rotate (#1371)

Co-authored-by: Hunter Morgan <hmorgan@bellflight.com>
This commit is contained in:
Hunter522
2022-03-22 02:44:23 -05:00
committed by GitHub
parent 805539b50d
commit 0a400a5bcc
3 changed files with 38 additions and 2 deletions

View File

@@ -4,7 +4,10 @@ use eframe::egui;
use egui_extras::RetainedImage;
fn main() {
let options = eframe::NativeOptions::default();
let options = eframe::NativeOptions {
initial_window_size: Some(egui::vec2(500.0, 900.0)),
..Default::default()
};
eframe::run_native(
"Show an image with eframe/egui",
options,
@@ -34,6 +37,12 @@ impl eframe::App for MyApp {
ui.heading("This is an image:");
self.image.show(ui);
ui.heading("This is a rotated image:");
ui.add(
egui::Image::new(self.image.texture_id(ctx), self.image.size_vec2())
.rotate(45.0_f32.to_radians(), egui::Vec2::splat(0.5)),
);
ui.heading("This is an image you can click:");
ui.add(egui::ImageButton::new(
self.image.texture_id(ctx),