Skip to main content

Crate egui_rotate

Crate egui_rotate 

Source
Expand description

§egui-rotate

Viewport rotation (0° / 90° / 180° / 270°) for egui.

Use cases: virtual pinball cabinets, kiosks, embedded displays, industrial panels — any setup where the physical screen is mounted rotated and the OS cannot (or should not) rotate the whole desktop.

This crate does not modify egui: it ships RotationPlugin, a self-contained egui::Plugin. Register it once and rotation becomes transparent for input, rendering and the OS cursor — on any backend (egui_glow, egui_wgpu, eframe, custom), with no other integration code.

§Quick start

use egui_rotate::{Rotation, RotationPlugin};

ctx.add_plugin(RotationPlugin::new(Rotation::CW90));

That’s it: pointer/touch input is remapped into the rotated space, the whole UI is rendered rotated, and directional OS cursor icons are remapped.

§Multiple windows

Rotation is per-viewport and opt-in. RotationPlugin::new configures the root window; child windows pass through untouched unless you configure them with RotationPlugin::set_viewport_rotation. So a rotated cabinet window can coexist with upright settings dialogs.

§Software cursor (feature software-cursor, opt-in)

Enable with egui-rotate = { version = "…", features = ["software-cursor"] }. See [SoftwareCursor] for the rotated virtual cursor used by pinball cabinets and kiosks where the OS cursor cannot be rotated; attach it with [RotationPlugin::with_software_cursor].

§Custom integration (without the plugin)

If you cannot use the plugin, the building blocks are public: Rotation’s transform methods for input, and rotate_clipped_shapes / rotate_shape to rotate pre-tessellation shapes. The older manual helpers transform_raw_input and transform_clipped_primitives are deprecated since 1.0 — prefer the plugin.

Structs§

RotationPlugin
A egui::Plugin that applies per-viewport rotation transparently.

Enums§

Rotation
Viewport rotation in 90-degree increments (clockwise).

Traits§

CursorIconExt
Extension trait for CursorIcon adding rotation-aware remapping.

Functions§

rotate_clipped_shapes
Rotate pre-tessellation ClippedShapes from logical UI space back to physical screen space, in place.
rotate_shape
Rotate a single Shape from logical UI space back to physical screen space, in place.
transform_clipped_primitivesDeprecated
Transform tessellated primitives from logical UI space back to physical screen space.
transform_raw_inputDeprecated
Transform a RawInput from physical screen space to logical UI space.