Available on crate feature
egui only.Expand description
egui integration (requires the egui feature). See on_egui.
use hao_il2cpp_unity::egui;
egui::on_egui(|ctx| {
egui::Window::new("my mod").show(ctx, |ui| {
ui.label("hello from Rust");
});
})?;Modules§
- accessibility
- Helpers for the accessibility tree.
- accesskit
- cache
- Caches for preventing the same value from being recomputed every frame.
- class
- containers
- Containers are pieces of the UI which wraps other pieces of UI. Examples:
Window,ScrollArea,Resize,Panel, 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
- os
- output
- All the data egui returns to the backend at the end of each frame.
- plugin
- response
- 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_
style - widget_
text - widgets
- Widgets are pieces of GUI such as
Label,Button,Slideretc.
Macros§
- generate_
loader_ id - Used to get a unique ID when implementing one of the loader traits:
BytesLoader::id,ImageLoader::id, andTextureLoader::id. - github_
link_ file - Create a
Hyperlinkto the currentfile!()on github. - github_
link_ file_ line - Create a
Hyperlinkto the currentfile!()(and line) on Github - include_
image - Include an image in the binary.
Structs§
- Align2
- Two-dimension alignment, e.g.
Align2::LEFT_TOP. - Aligned
- Align some widgets of unknown size within the available space of a
Ui. - Allocated
Widget Atom - Instructions for painting a
WidgetAtom. - Area
- An area on the screen that can be moved by dragging.
- Area
State - State of an
Areathat is persisted between frames. - Atom
- A low-level ui building block.
- Atom
Paint Args - Args passed when painting an
AtomKind::Paintatom. - Atoms
- A list of
Atoms. - Button
- Clickable button with text.
- Central
Panel - 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.
- Clipped
Primitive - A
MeshorPaintCallbackwithin a clip rectangle. - Closable
Tag - A tag to mark a container as closable.
- Collapsing
Header - A header which can be collapsed/expanded, revealing a contained
Uiregion. - Collapsing
Response - The response from showing a
CollapsingHeader. - Color32
- This format is used for space-efficient color representation (32 bits).
- Color
Image - A 2D RGBA color image in RAM.
- Combo
Box - A drop-down selection menu with a descriptive label.
- Completion
Output - The result of
CompletionPopup::show. - Completion
Popup - A code completion popup over a
TextEdit. - Completion
Query - What the
CompletionPopupasks for suggestions for. - Container
Atom - Describes how a set of
crate::Atoms is laid out and painted. - Context
- Your handle to egui.
- Corner
Radius - How rounded the corners of things should be.
- Custom
Cursor Image - A bitmap cursor pushed to the integration via
PlatformOutput::cursor_image. - Drag
AndDrop - Plugin for tracking drag-and-drop payload.
- Drag
PanButtons - Specifies which pointer buttons can be used to pan the scene by dragging.
- Drag
Value - A numeric value that you can change by dragging the number. More compact than a
crate::Slider. - Drag
Value Settings - The editable numbers a slider shows beside its rail, one per handle.
- Event
Filter - Controls which events that a focused widget will have exclusive access to.
- Fallback
Request - Input to a
FontProvider. - Font
Data - A
.ttfor.otffile and a font face index. - Font
Definitions - Describes a set of pre-configured fonts.
- FontId
- How to select a sized font.
- Font
Insert - A font to add to
FontDefinitions, and which families to add it to. - Font
Tweak - Extra scale and vertical tweak to apply to all text of a certain font.
- Frame
- A frame around some content, including margin, colors, etc.
- Frame
Durations - Stores the durations between each frame of an animated image
- Full
Output - What egui emits each frame from
crate::Context::run_ui. - Galley
- Text that has been laid out, ready for painting.
- Glyph
Bitmap - A glyph bitmap, ready to be copied into the glyph atlas.
- Glyph
Rasterizer - Rasterizes grapheme clusters using something other than the installed fonts, e.g. the browser on web, or your own custom glyphs.
- Glyph
Rasterizer Request - Input to a
GlyphRasterizer. - Grid
- A simple grid layout.
- Hovered
File - A file about to be dropped into egui.
- Hyperlink
- A clickable hyperlink, e.g. to
"https://github.com/emilk/egui". - Icon
Data - Image data for an application icon.
- Id
- A (hopefully) unique identity within this application.
- IdSalt
- A “locally unique” identifier, e.g. to identify a child widget within a parent widget.
- Image
- A widget which displays an image.
- Image
Options - Image
Size - This type determines the constraints on how the size of an image should be calculated.
- Immediate
Viewport - Viewport for immediate rendering.
- Inner
Response - 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.:
- Input
Options - Options for input state handling.
- Input
State - Input state that egui updates each frame.
- Insert
Font Family - Where in the fallback chain of a
FontFamilyaFontInsertgoes. - Interact
Options - How to handle multiple calls to
crate::Response::interactandcrate::Ui::interact_opt. - Into
Sized Args - Args passed when sizing an
super::Atom - Into
Sized Result - Result returned when sizing an
super::Atom - Keyboard
Shortcut - 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.
- Logic
Output - What egui emits from
crate::Context::run_logic, i.e. from a tick where no ui was shown. - 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.
- MenuBar
- Horizontal menu bar where you can add
MenuButtons. - Mesh
- Textured triangles in two dimensions.
- Modal
- A modal dialog.
- Modal
Response - The response of a modal dialog.
- Modifier
Names - Names of different modifier keys.
- Modifiers
- State of the modifier keys. These must be fed to egui.
- Multi
Touch Info - 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.
- Paint
Callback - If you want to paint some 3D shapes inside an egui region, you can use this.
- Paint
Callback Info - Information passed along with
PaintCallback(Shape::Callback). - Painter
- Helper to paint shapes and text to a specific region on a specific layer.
- Panel
- A panel that covers an entire side
(
left,right,toporbottom) of aUior screen. - Panel
State - State regarding panels.
- Platform
Output - The non-rendering part of what egui emits each frame.
- Pointer
State - Mouse or touch state.
- Popup
- A popup container.
- Pos2
- A position on screen.
- Progress
Bar - A simple progress bar.
- Radio
Button - One out of several alternatives, either selected or not.
- Range
Slider - Select a range of numbers with a two-handled slider.
- Rangef
- Inclusive range of floats, i.e.
min..=max, but more ergonomic thanRangeInclusive. - Rasterized
Glyph - A glyph rasterized by a
GlyphRasterizer. - RawInput
- What the integrations provides to egui at the start of each frame.
- Rect
- A rectangular region of space.
- Rect
Align - Position a child
Rectrelative to a parentRect. - Repaint
Cause - What called
Context::request_repaintorContext::request_discard? - Request
Repaint Info - 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
RGBAcolor with premultiplied alpha. - Rich
Text - Text and optional style choices for it.
- Safe
Area Insets - The ‘safe area’ insets of the screen
- Scene
- A container that allows you to zoom and pan.
- Screenshot
Callback - A one-shot callback for receiving a screenshot.
- Scroll
Area - Add vertical and/or horizontal scrolling to a contained
Ui. - 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.
- Sides
- Put some widgets on the left and right sides of a ui.
- Sized
Atom - A
crate::Atomwhich has been sized. - Sized
Container Atom - A measured
ContainerAtom, ready to be painted at aRect. - Sized
Widget Atom - A measured
WidgetAtom: aSizedContainerAtomplus theIdandSenseneeded to allocate aResponse. - Slider
- Control a number with a slider.
- Slider
Spec - How values are spread along a slider’s rail.
- 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.
- Suggestion
- One item in a
CompletionPopup. - Text
Edit - A text region that the user can edit the contents of.
- Text
Format - Formatting option for a section of text.
- Texture
Handle - Used to paint images.
- Texture
Options - How the texture texels are filtered.
- Textures
Delta - What has been allocated and freed during the last period.
- Tooltip
- Touch
Device Id - this is a
u64as 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
- The properties specified when creating a top-level or child
Ui. - UiStack
- Information about a
crate::Uiand its parents. - UiStack
Info - Information about a
crate::Uito be included in the correspondingUiStack. - UiStack
Iterator - Iterator that walks up a stack of
StackFrames. - UiTags
- User-chosen tags.
- Value
Format - How a number is written, read back, and applied while being edited.
- Vec2
- A vector has a direction and length.
A
Vec2is often used to represent a size. - Vec2b
- Two bools, one for each axis (X and Y).
- Viewport
Builder - Control the building of a new egui viewport (i.e. native window).
- Viewport
Id - A unique identifier of a viewport.
- Viewport
IdPair - A pair of
ViewportId, used to identify a viewport and its parent. - Viewport
Info - Information about the current viewport, given as input each frame.
- Viewport
Output - Describes a viewport, i.e. a native window.
- Visuals
- Controls the visual style (colors etc) of egui.
- Widget
Atom - An atom-based widget: a
ContainerAtomplus everything needed to show it inside aUi. - Widget
Atom Response - Response from a
WidgetAtom::showorAllocatedWidgetAtom::paint. - Widget
Info - Describes a widget such as a
crate::Buttonor acrate::TextEdit. - Widget
Rect - Used to store each widget’s Id, Rect and Sense each frame.
- Widget
Rects - 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§
- Align
- left/center/right or top/center/bottom alignment for e.g. anchors and layouts.
- Atom
Kind - The different kinds of
crate::Atoms. - Cursor
Grab - Cursor
Icon - A mouse cursor icon.
- Direction
- A cardinal direction, one of
LeftToRight,RightToLeft,TopDown,BottomUp. - Event
- An input event generated by the integration.
- Focus
Direction - A direction in which to move the keyboard focus.
- Font
Family - Font of unknown size.
- Font
Priority - Whether an inserted font (or
crate::text::GlyphRasterizer) goes before or after the existing fonts of a family. - Font
Selection - A way to select
FontId, either by picking one directly or by using aTextStyle. - IMEPurpose
- IdSource
- Is this
Uia root or a child of anotherUi? - Image
Data - An image stored in RAM.
- Image
Fit - This type determines how the image should try to fit within the UI.
- Image
Source - This type tells the
Uihow to load an image. - ImeEvent
- IME event.
- Key
- Keyboard keys.
- Missing
Glyph Policy - What to do with a character that nothing can draw: no installed font has it,
no
FontProviderfinds a font for it, and noGlyphRasterizerhandles it. - Mouse
Wheel Source - What is driving an
crate::Event::MouseWheelevent. - Mouse
Wheel Unit - The unit associated with the numeric value of a mouse wheel event
- Order
- Different layer categories
- Output
Command - Commands that the egui integration should execute at the end of a frame.
- Pointer
Button - Mouse button (or similar for touch input)
- Popup
Anchor - What should we anchor the popup to?
- Popup
Close Behavior - Determines popup’s close behavior
- Popup
Kind - Is the popup a popup, tooltip or menu?
- Resize
Direction - Role
- The type of an accessibility node.
- SetOpen
Command - Shape
- A paint primitive such as a circle or a piece of text. Coordinates are all screen space points (not physical pixels).
- Size
Hint - Given as a hint for image loading requests.
- Sized
Atom Kind - A sized
crate::AtomKind. - Slider
Clamping - Specifies how values in a
Sliderare clamped. - Slider
Orientation - Specifies the orientation of a
Slider. - Stroke
Kind - Describes how the stroke of a shape should be painted.
- Surrender
Focus On - System
Theme - Text
Style - Alias for a
FontId(font of a certain size). - Text
Wrap Mode - How to wrap and elide text.
- Texture
Filter - How the texture texels are filtered.
- Texture
Id - What texture to use in a
Meshmesh. - Texture
Wrap Mode - Defines how textures are wrapped around objects when texture coordinates fall outside the [0, 1] range.
- Theme
- Dark or Light theme.
- Theme
Preference - The user’s theme preference.
- Touch
Phase - In what phase a touch event is in.
- UiKind
- What kind is this
crate::Ui? - User
Attention Type - Types of attention to request from a user when a native window is not in focus.
- Viewport
Class - The different types of viewports supported by egui.
- Viewport
Command - An output viewport-command from egui to the backend, e.g. to change the window title or size.
- Viewport
Event - An input event from the backend into egui, about a specific viewport.
- Widget
Text - This is how you specify text for a widget.
- Window
Drag - Where the user can drag to move a
Window. - Window
Level - For winit platform compatibility, see
winit::WindowLeveldocumentation - X11Window
Type
Constants§
- MAX_
GLYPH_ SIZE - Maximum width or height of a glyph rasterized into the font atlas.
- NUM_
POINTER_ BUTTONS - Number of pointer buttons supported by egui, i.e. the number of possible states of
PointerButton.
Traits§
- AsId
Deprecated - Deprecated
- AsId
Salt - Types that can be converted to an
IdSalt. - AtomExt
- A trait for conveniently building
Atoms. - Dropped
File - A file dropped into egui.
- Font
Provider - A source of fonts.
- Into
Atoms - Trait for turning a tuple of
Atoms intoAtoms. - NumExt
- Extends
f32,Vec2etc withat_leastandat_mostas aliases formaxandmin. - Plugin
- A plugin to extend egui.
- Text
Buffer - Trait constraining what types
crate::TextEditmay use as an underlying buffer. - Widget
- Anything implementing Widget can be added to a
UiwithUi::add. - Widget
With State - 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.
- accesskit_
root_ id - decode_
animated_ image_ uri - Extracts uri and frame index
- global_
theme_ preference_ buttons - Show a row of buttons for changing the theme of the whole app.
- global_
theme_ preference_ switch Deprecated - Show a small button to switch to/from dark/light mode (globally).
- has_
emoji_ presentation - Does this grapheme cluster have emoji presentation, per Unicode (UTS #51)?
- has_
gif_ magic_ header - Checks if bytes are gifs
- has_
webp_ header - Checks if bytes are webp
- lerp
- Linear interpolation.
- on_egui
- Runs
uievery frame to build and draw an egui interface over the game. - paint_
texture_ at - pos2
pos2(x, y) == Pos2::new(x, y)- register_
user_ texture - Registers a Unity texture object for use in egui as a user texture.
- remap
- Linearly remap a value from one range to another,
so that when
x == from.start()returnsto.start()and whenx == from.end()returnsto.end(). - remap_
clamp - Like
remap, but also clamps the value so that the returned value is always in thetorange. - 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.
- role_
description - A human-readable, lowercase name for a widget role, e.g. for a text-to-speech system.
- set_
ui_ scale - Scales the egui overlay UI. A value of 0.5 makes the UI half-size; 2.0 makes it double-size. Font rasterization quality is preserved — only the coordinate space is scaled. Pass 0.0 to reset to the default (1.0).
- unregister_
user_ texture - Removes a previously registered user texture.
- vec2
vec2(x, y) == Vec2::new(x, y)- warn_
if_ debug_ build - Helper function that adds a label when compiling with debug assertions enabled.
Type Aliases§
- Allocated
Atom Layout Deprecated - Renamed to
AllocatedWidgetAtom. - Atom
Closure - See
AtomKind::Closure - Atom
Layout Deprecated AtomLayoutwas split intoWidgetAtom(id, sense, allocation) andContainerAtom(layout & painting).WidgetAtomis the direct replacement.- Atom
Layout Response Deprecated - Renamed to
WidgetAtomResponse. - Atom
Paint - See
AtomKind::Paint - Boxed
Widget - A dynamically dispatched
Widget. - Custom
Rects - The custom atom rects collected while painting, keyed by atom salt.
- Deferred
Viewport UiCallback - The user-code that shows the ui in the viewport, used for deferred viewports.
- Dropped
File Handle - A shared reference to a dropped file.
- Icon
Painter - A function that paints the
ComboBoxicon - IdMap
IdMap<V>is aHashMap<Id, V>optimized by knowing thatIdhas good entropy, and doesn’t need more hashing.- IdSalt
Map IdSaltMap<V>is aHashMap<IdSalt, V>optimized by knowing thatIdSalthas good entropy, and doesn’t need more hashing.- IdSalt
Set IdSaltSetis aHashSet<IdSalt>optimized by knowing thatIdSalthas good entropy, and doesn’t need more hashing.- IdSet
IdSetis aHashSet<Id>optimized by knowing thatIdhas good entropy, and doesn’t need more hashing.- Immediate
Viewport Renderer Callback - Render the given viewport, calling the given ui callback.
- NumFormatter
- Formats a value for display, given the range of decimals it may show.
- NumParser
- Parses what the user typed, returning
Noneif it is not a number. - Ordered
Viewport IdMap - An order map from
ViewportIdtoT. - Sized
Atom Layout Deprecated SizedAtomLayoutwas split intoSizedWidgetAtom(id, sense) andSizedContainerAtom(the measured contents).SizedWidgetAtomis the direct replacement.- Viewport
IdMap - A fast hash map from
ViewportIdtoT. - Viewport
IdSet - A fast hash set of
ViewportId. - Widget
Type Deprecated - The old name for the type of a widget, now expressed as an
accesskit::Role.