Skip to main content

Module egui

Module egui 

Source
Expand description

egui integration (requires the egui feature). See on_egui.

Modules§

ahash
AHash is a high performance keyed hash function.
containers
Containers are pieces of the UI which wraps other pieces of UI. Examples: Window, ScrollArea, Resize, SidePanel, etc.
debug_text
This is an example of how to create a plugin for egui.
epaint
A simple 2D graphics library for turning simple 2D shapes and text into textured triangles.
gui_zoom
Helpers for zooming the whole GUI of an app (changing Context::pixels_per_point.
introspection
Showing UI:s for egui/epaint types.
layers
Handles paint layers, i.e. how things are sometimes painted behind or in front of other things.
load
Image loading
menu
Menu bar functionality (very basic so far).
os
output
All the data egui returns to the backend at the end of each frame.
special_emojis
The default egui fonts supports around 1216 emojis in total. Here are some of the most useful: ∞⊗⎗⎘⎙⏏⏴⏵⏶⏷ ⏩⏪⏭⏮⏸⏹⏺■▶📾🔀🔁🔃 ☀☁★☆☐☑☜☝☞☟⛃⛶✔ ↺↻⟲⟳⬅➡⬆⬇⬈⬉⬊⬋⬌⬍⮨⮩⮪⮫ ♡ 📅📆 📈📉📊 📋📌📎📤📥🔆 🔈🔉🔊🔍🔎🔗🔘 🕓🖧🖩🖮🖱🖴🖵🖼🗀🗁🗋🗐🗑🗙🚫❓
style
egui theme (spacing, colors, etc).
text
text_selection
Helpers regarding text selection for labels and text edit.
util
Miscellaneous tools used by the rest of egui.
viewport
egui supports multiple viewports, corresponding to multiple native windows.
widget_text
widgets
Widgets are pieces of GUI such as Label, Button, Slider etc.

Macros§

generate_loader_id
Used to get a unique ID when implementing one of the loader traits: BytesLoader::id, ImageLoader::id, and TextureLoader::id.
github_link_file
Create a Hyperlink to the current file!() on github.
github_link_file_line
Create a Hyperlink to the current file!() (and line) on Github
include_image
Include an image in the binary.

Structs§

Align2
Two-dimension alignment, e.g. Align2::LEFT_TOP.
Area
An area on the screen that can be moved by dragging.
AreaState
State of an Area that is persisted between frames.
Button
Clickable button with text.
CentralPanel
A panel that covers the remainder of the screen, i.e. whatever area is left after adding other panels.
Checkbox
Boolean on/off control with text label.
ClippedPrimitive
A Mesh or PaintCallback within a clip rectangle.
CollapsingHeader
A header which can be collapsed/expanded, revealing a contained Ui region.
CollapsingResponse
The response from showing a CollapsingHeader.
Color32
This format is used for space-efficient color representation (32 bits).
ColorImage
A 2D RGBA color image in RAM.
ComboBox
A drop-down selection menu with a descriptive label.
Context
Your handle to egui.
DragAndDrop
Tracking of drag-and-drop payload.
DragValue
A numeric value that you can change by dragging the number. More compact than a crate::Slider.
DroppedFile
A file dropped into egui.
EventFilter
Controls which events that a focused widget will have exclusive access to.
FontData
A .ttf or .otf file and a font face index.
FontDefinitions
Describes the font data and the sizes to use.
FontId
How to select a sized font.
FontImage
A single-channel image designed for the font texture.
FontTweak
Extra scale and vertical tweak to apply to all text of a certain font.
Frame
Add a background, frame and/or margin to a rectangular background of a Ui.
FullOutput
What egui emits each frame from crate::Context::run.
Galley
Text that has been laid out, ready for painting.
GifFrameDurations
Stores the durations between each frame of a gif
Grid
A simple grid layout.
HoveredFile
A file about to be dropped into egui.
Hyperlink
A clickable hyperlink, e.g. to "https://github.com/emilk/egui".
IconData
Image data for an application icon.
Id
egui tracks widgets frame-to-frame using Ids.
Image
A widget which displays an image.
ImageButton
A clickable image within a frame.
ImageOptions
ImageSize
This type determines the constraints on how the size of an image should be calculated.
ImmediateViewport
Viewport for immediate rendering.
InnerResponse
Returned when we wrap some ui-code and want to return both the results of the inner function and the ui as a whole, e.g.:
InputState
Input state that egui updates each frame.
KeyboardShortcut
A keyboard shortcut, e.g. Ctrl+Alt+W.
Label
Static text.
LayerId
An identifier for a paint layer. Also acts as an identifier for crate::Area:s.
Layout
The layout of a Ui, e.g. “vertical & centered”.
Link
Clickable text, that looks like a hyperlink.
Margin
A value for all four sides of a rectangle, often used to express padding or spacing.
Memory
The data that egui persists between frames.
Mesh
Textured triangles in two dimensions.
ModifierNames
Names of different modifier keys.
Modifiers
State of the modifier keys. These must be fed to egui.
MultiTouchInfo
All you probably need to know about a multi-touch gesture.
OpenUrl
What URL to open, and how.
Options
Some global options that you can read and write.
PaintCallback
If you want to paint some 3D shapes inside an egui region, you can use this.
PaintCallbackInfo
Information passed along with PaintCallback (Shape::Callback).
Painter
Helper to paint shapes and text to a specific region on a specific layer.
PlatformOutput
The non-rendering part of what egui emits each frame.
PointerState
Mouse or touch state.
Pos2
A position on screen.
ProgressBar
A simple progress bar.
RadioButton
One out of several alternatives, either selected or not.
Rangef
Inclusive range of floats, i.e. min..=max, but more ergonomic than RangeInclusive.
RawInput
What the integrations provides to egui at the start of each frame.
Rect
A rectangular region of space.
RepaintCause
What called Context::request_repaint or Context::request_discard?
RequestRepaintInfo
Information given to the backend about when it is time to repaint the ui.
Resize
A region that can be resized by dragging the bottom right corner.
Response
The result of adding a widget to a Ui.
Rgba
0-1 linear space RGBA color with premultiplied alpha.
RichText
Text and optional style choices for it.
Rounding
How rounded the corners of things should be
ScrollArea
Add vertical and/or horizontal scrolling to a contained Ui.
SelectableLabel
One out of several alternatives, either selected or not. Will mark selected items with a different background color. An alternative to crate::RadioButton and crate::Checkbox.
Sense
What sort of interaction is a widget sensitive to?
Separator
A visual separator. A horizontal or vertical line (depending on crate::Layout).
Shadow
The color and fuzziness of a fuzzy shape.
SidePanel
A panel that covers the entire left or right side of a Ui or screen.
Sides
Put some widgets on the left and right sides of a ui.
Slider
Control a number with a slider.
Spacing
Controls the sizes and distances between widgets.
Spinner
A spinner widget used to indicate loading.
Stroke
Describes the width and color of a line.
Style
Specifies the look and feel of egui.
TextEdit
A text region that the user can edit the contents of.
TextFormat
Formatting option for a section of text.
TextureHandle
Used to paint images.
TextureOptions
How the texture texels are filtered.
TexturesDelta
What has been allocated and freed during the last period.
TopBottomPanel
A panel that covers the entire top or bottom of a Ui or screen.
TouchDeviceId
this is a u64 as values of this kind can always be obtained by hashing
TouchId
Unique identification of a touch occurrence (finger or pen or …). A Touch ID is valid until the finger is lifted. A new ID is used for the next touch.
Ui
This is what you use to place widgets.
UiBuilder
Build a Ui as the chlild of another Ui.
UiStack
Information about a crate::Ui and its parents.
UiStackInfo
Information about a crate::Ui to be included in the corresponding UiStack.
UiStackIterator
Iterator that walks up a stack of StackFrames.
UiTags
User-chosen tags.
Vec2
A vector has a direction and length. A Vec2 is often used to represent a size.
Vec2b
Two bools, one for each axis (X and Y).
ViewportBuilder
Control the building of a new egui viewport (i.e. native window).
ViewportId
A unique identifier of a viewport.
ViewportIdPair
A pair of ViewportId, used to identify a viewport and its parent.
ViewportInfo
Information about the current viewport, given as input each frame.
ViewportOutput
Describes a viewport, i.e. a native window.
Visuals
Controls the visual style (colors etc) of egui.
WidgetInfo
Describes a widget such as a crate::Button or a crate::TextEdit.
WidgetRect
Used to store each widget’s Id, Rect and Sense each frame.
WidgetRects
Stores the WidgetRects of all widgets generated during a single egui update/frame.
Window
Builder for a floating window which can be dragged, closed, collapsed, resized and scrolled (off by default).

Enums§

AboveOrBelow
Indicate whether a popup will be shown above or below the box.
Align
left/center/right or top/center/bottom alignment for e.g. anchors and layouts.
CursorGrab
CursorIcon
A mouse cursor icon.
Direction
Layout direction, one of LeftToRight, RightToLeft, TopDown, BottomUp.
Event
An input event generated by the integration.
FontFamily
Font of unknown size.
FontSelection
A way to select FontId, either by picking one directly or by using a TextStyle.
IMEPurpose
ImageData
An image stored in RAM.
ImageFit
This type determines how the image should try to fit within the UI.
ImageSource
This type tells the Ui how to load an image.
ImeEvent
IME event.
Key
Keyboard keys.
MouseWheelUnit
The unit associated with the numeric value of a mouse wheel event
Order
Different layer categories
PointerButton
Mouse button (or similar for touch input)
PopupCloseBehavior
Determines popup’s close behavior
ResizeDirection
Shape
A paint primitive such as a circle or a piece of text. Coordinates are all screen space points (not physical pixels).
SizeHint
Given as a hint for image loading requests.
SliderClamping
Specifies how values in a Slider are clamped.
SliderOrientation
Specifies the orientation of a Slider.
SystemTheme
TextStyle
Alias for a FontId (font of a certain size).
TextWrapMode
How to wrap and elide text.
TextureFilter
How the texture texels are filtered.
TextureId
What texture to use in a Mesh mesh.
TextureWrapMode
Defines how textures are wrapped around objects when texture coordinates fall outside the [0, 1] range.
Theme
Dark or Light theme.
ThemePreference
The user’s theme preference.
TouchPhase
In what phase a touch event is in.
UiKind
What kind is this crate::Ui?
UserAttentionType
Types of attention to request from a user when a native window is not in focus.
ViewportClass
The different types of viewports supported by egui.
ViewportCommand
An output viewport-command from egui to the backend, e.g. to change the window title or size.
ViewportEvent
An input event from the backend into egui, about a specific viewport.
WidgetText
This is how you specify text for a widget.
WidgetType
The different types of built-in widgets in egui
WindowLevel
X11WindowType

Constants§

NUM_POINTER_BUTTONS
Number of pointer buttons supported by egui, i.e. the number of possible states of PointerButton.

Traits§

NumExt
Extends f32, Vec2 etc with at_least and at_most as aliases for max and min.
TextBuffer
Trait constraining what types crate::TextEdit may use as an underlying buffer.
Widget
Anything implementing Widget can be added to a Ui with Ui::add.
WidgetWithState
Helper so that you can do e.g. TextEdit::State::load.

Functions§

__run_test_ctx
For use in tests; especially doctests.
__run_test_ui
For use in tests; especially doctests.
decode_gif_uri
extracts uri and frame index
global_dark_light_mode_buttonsDeprecated
Show larger buttons for switching between light and dark mode (globally).
global_dark_light_mode_switchDeprecated
Show a small button to switch to/from dark/light mode (globally).
global_theme_preference_buttons
Show larger buttons for switching between light and dark mode (globally).
global_theme_preference_switch
Show a small button to switch to/from dark/light mode (globally).
has_gif_magic_header
checks if bytes are gifs
lerp
Linear interpolation.
next_tooltip_id
What is the id of the next tooltip for this widget?
on_egui
Runs ui every frame to build and draw an egui interface over the game.
paint_texture_at
popup_above_or_below_widget
Shows a popup above or below another widget.
popup_below_widget
Helper for popup_above_or_below_widget.
pos2
pos2(x, y) == Pos2::new(x, y)
remap
Linearly remap a value from one range to another, so that when x == from.start() returns to.start() and when x == from.end() returns to.end().
remap_clamp
Like remap, but also clamps the value so that the returned value is always in the to range.
reset_button
Show a button to reset a value to its default. The button is only enabled if the value does not already have its original value.
reset_button_with
Show a button to reset a value to its default. The button is only enabled if the value does not already have its original value.
seconds_since_last_tooltip
show_tooltip
Show a tooltip at the current pointer position (if any).
show_tooltip_at
Show a tooltip at the given position.
show_tooltip_at_pointer
Show a tooltip at the current pointer position (if any).
show_tooltip_for
Show a tooltip under the given area.
show_tooltip_text
Show some text at the current pointer position (if any).
stroke_uiDeprecated
tooltip_id
vec2
vec2(x, y) == Vec2::new(x, y)
warn_if_debug_build
Helper function that adds a label when compiling with debug assertions enabled.
was_tooltip_open_last_frame
Was this popup visible last frame?

Type Aliases§

DeferredViewportUiCallback
The user-code that shows the ui in the viewport, used for deferred viewports.
IconPainter
A function that paints the ComboBox icon
IdMap
IdMap<V> is a HashMap<Id, V> optimized by knowing that Id has good entropy, and doesn’t need more hashing.
ImmediateViewportRendererCallback
Render the given viewport, calling the given ui callback.
ViewportIdMap
A fast hash map from ViewportId to T.
ViewportIdSet
A fast hash set of ViewportId.