pub struct EguiBridge {
pub max_texture_bits: u8,
/* private fields */
}Expand description
Primary Egui Interface.
Fields§
§max_texture_bits: u8Number of bits allowed for texture size.
The texture will be 2^max_texture_size
Implementations§
Source§impl EguiBridge
impl EguiBridge
pub fn get_max_texture_bits(&self) -> <u8 as GodotConvert>::Via
pub fn set_max_texture_bits( &mut self, max_texture_bits: <u8 as GodotConvert>::Via, )
Source§impl EguiBridge
APIs for spawning viewports.
impl EguiBridge
APIs for spawning viewports.
Key for every APIs are that any access to egui::Context triggers
Sourcepub fn setup_context(&self, setter: impl FnOnce(&Context) + 'static + Send)
pub fn setup_context(&self, setter: impl FnOnce(&Context) + 'static + Send)
Access to egui context at intra-frame. This will be called immediately if we’re already out of frame boundary(e.g. start..end), otherwise, queue it to be called later.
Sourcepub fn sync_root_region(&self, target: Option<Gd<Control>>)
pub fn sync_root_region(&self, target: Option<Gd<Control>>)
Synchronize root viewport’s region with given control. If None is given, it
unregisters synchronization.
Sourcepub fn current_frame(&self) -> &Context
pub fn current_frame(&self) -> &Context
Start a new frame (if required), and return context which you can draw with.
This is very default way of using EGUI, and anything you draw upon this will be
shown below the spawned root canvas; EguiBridge
Use this when you want to draw widget every frame within process() function.
§Caveats
- Cloning
egui::Contextand access it directly out of provided lifecycle is not recommneded. Please guarantee that you only access this context within main thread, right after callingcurrent_frame.
§Panics
- Called from non main gameplay thread.
Sourcepub fn viewport_immediate<R>(
&self,
id: ViewportId,
builder: ViewportBuilder,
show: impl FnMut(&Context, ViewportClass) -> R,
) -> R
pub fn viewport_immediate<R>( &self, id: ViewportId, builder: ViewportBuilder, show: impl FnMut(&Context, ViewportClass) -> R, ) -> R
Render viewport for current frame.
This is shortcut to following code.
let id = ViewportId::from_hash("123");
let builder = ViewportBuilder::default();
bridge.current_frame().show_viewport_immediate(
id, builder, |ctx, viewport_class| {
// do something ...
}
);§Panics
Sourcepub fn viewport_spawn<L>(
&self,
id: ViewportId,
builder: ViewportBuilder,
show: impl FnMut(&Context) -> L + 'static,
)where
L: Into<WidgetRetain>,
pub fn viewport_spawn<L>(
&self,
id: ViewportId,
builder: ViewportBuilder,
show: impl FnMut(&Context) -> L + 'static,
)where
L: Into<WidgetRetain>,
Spawn new viewport, which renders provided callback at the start of next frame. This is thread-safe, however, you should call exactly once per gameplay frame to ensure viewport is persisted correctly.
This is inherently a shortcut to following code.
let id = ViewportId::from_hash("123");
let builder = ViewportBuilder::default();
bridge.egui_start().show_viewport_deferred(
id, builder, move |ctx, viewport_class| {
// do something ...
// Viewport will be retained as long as you
true
}
);Sourcepub fn register_render_callback_first<L>(
&self,
priority: i32,
widget: impl FnEguiDraw<L>,
)where
L: Into<WidgetRetain>,
pub fn register_render_callback_first<L>(
&self,
priority: i32,
widget: impl FnEguiDraw<L>,
)where
L: Into<WidgetRetain>,
Registers callback for widget rendering at frame start.
See also FnEguiDrawExt decorator for every method with signature
impl FnMut(&egui::Context) -> impl Into<WidgetRetain> + 'static
Callbacks registered with lower priority will be called earlier.
Sourcepub fn register_render_callback_last<L>(
&self,
priority: i32,
widget: impl FnEguiDraw<L>,
)where
L: Into<WidgetRetain>,
pub fn register_render_callback_last<L>(
&self,
priority: i32,
widget: impl FnEguiDraw<L>,
)where
L: Into<WidgetRetain>,
Registers callback for widget rendering at frame end.
See also FnEguiDrawExt decorator for every method with signature
impl FnMut(&egui::Context) -> impl Into<WidgetRetain> + 'static
Callbacks registered with lower priority will be called earlier.
Sourcepub fn viewport_spawn_as_child(
&self,
_id: ViewportId,
_parent: Gd<Control>,
_builder: ViewportBuilder,
_show: impl FnOnce(&Context) -> WidgetRetain + 'static,
)
pub fn viewport_spawn_as_child( &self, _id: ViewportId, _parent: Gd<Control>, _builder: ViewportBuilder, _show: impl FnOnce(&Context) -> WidgetRetain + 'static, )
Spawn new viewport as child of existing node. If specified parent node is behind other node, the input may work naturally as the egui surface always intercepts any GUI input. It is advised to use this method for any node that lays over any other GUI nodes, which makes all egui rendering appear always top of the other GUI nodes.
Sourcepub fn attach_node_to_viewport(
&self,
_id: ViewportId,
node: Gd<Node>,
) -> Result<(), Gd<Node>>
pub fn attach_node_to_viewport( &self, _id: ViewportId, node: Gd<Node>, ) -> Result<(), Gd<Node>>
Attach given node to given viewport’s window.
TODO: Implement this!
Trait Implementations§
Source§impl Bounds for EguiBridge
impl Bounds for EguiBridge
Source§impl GodotClass for EguiBridge
impl GodotClass for EguiBridge
Source§type Base = CanvasLayer
type Base = CanvasLayer
T. This is always a Godot engine class.Source§fn class_id() -> ClassId
fn class_id() -> ClassId
Source§fn class_name() -> ClassId
fn class_name() -> ClassId
Renamed to class_id()
Source§const INIT_LEVEL: InitLevel = <Self::Base as GodotClass>::INIT_LEVEL
const INIT_LEVEL: InitLevel = <Self::Base as GodotClass>::INIT_LEVEL
impl GodotDefault for EguiBridge
Source§impl ICanvasLayer for EguiBridge
impl ICanvasLayer for EguiBridge
fn process(&mut self, _dt: f64)
fn enter_tree(&mut self)
fn exit_tree(&mut self)
Source§fn init(base: Base<Self::Base>) -> Self
fn init(base: Base<Self::Base>) -> Self
base object. Read moreSource§fn on_notification(&mut self, what: NodeNotification)
fn on_notification(&mut self, what: NodeNotification)
Source§fn get_property(&self, property: StringName) -> Option<Variant>
fn get_property(&self, property: StringName) -> Option<Variant>
Source§fn set_property(&mut self, property: StringName, value: Variant) -> bool
fn set_property(&mut self, property: StringName, value: Variant) -> bool
Source§fn get_property_list(&mut self) -> Vec<PropertyInfo>
fn get_property_list(&mut self) -> Vec<PropertyInfo>
get_property_list() is called, the returned vector here is
appended to the existing list of properties. Read moreSource§fn validate_property(&self, property: &mut PropertyInfo)
fn validate_property(&self, property: &mut PropertyInfo)
get_property_list(). Read moreSource§fn property_get_revert(&self, property: StringName) -> Option<Variant>
fn property_get_revert(&self, property: StringName) -> Option<Variant>
fn physics_process(&mut self, delta: f64)
fn ready(&mut self)
fn get_configuration_warnings(&self) -> PackedArray<GString>
fn get_accessibility_configuration_warnings(&self) -> PackedArray<GString>
fn input(&mut self, event: Gd<InputEvent>)
fn shortcut_input(&mut self, event: Gd<InputEvent>)
fn unhandled_input(&mut self, event: Gd<InputEvent>)
fn unhandled_key_input(&mut self, event: Gd<InputEvent>)
fn get_focused_accessibility_element(&self) -> Rid
impl ImplementsGodotApi for EguiBridge
impl ImplementsGodotExports for EguiBridge
impl ImplementsGodotVirtual for EguiBridge
Source§impl Inherits<CanvasLayer> for EguiBridge
impl Inherits<CanvasLayer> for EguiBridge
Source§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read moreSource§impl Inherits<Node> for EguiBridge
impl Inherits<Node> for EguiBridge
Source§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read moreSource§impl Inherits<Object> for EguiBridge
impl Inherits<Object> for EguiBridge
Source§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read moreSource§impl WithBaseField for EguiBridge
impl WithBaseField for EguiBridge
Source§fn base(&self) -> BaseRef<'_, Self>
fn base(&self) -> BaseRef<'_, Self>
&self engine methods on this object. Read moreSource§fn base_mut(&mut self) -> BaseMut<'_, Self>
fn base_mut(&mut self) -> BaseMut<'_, Self>
&self/&mut self engine methods on this object. Read moreSource§fn run_deferred<F>(&mut self, mut_self_method: F)where
F: FnOnce(&mut Self) + 'static,
fn run_deferred<F>(&mut self, mut_self_method: F)where
F: FnOnce(&mut Self) + 'static,
Source§fn run_deferred_gd<F>(&mut self, gd_function: F)
fn run_deferred_gd<F>(&mut self, gd_function: F)
Source§fn apply_deferred<F>(&mut self, rust_function: F)where
F: FnOnce(&mut Self) + 'static,
fn apply_deferred<F>(&mut self, rust_function: F)where
F: FnOnce(&mut Self) + 'static,
Split into run_deferred() + run_deferred_gd().
Source§impl WithSignals for EguiBridge
impl WithSignals for EguiBridge
Source§type SignalCollection<'c, C: WithSignals> = __godot_Signals_EguiBridge<'c, C>
type SignalCollection<'c, C: WithSignals> = __godot_Signals_EguiBridge<'c, C>
Source§impl WithUserSignals for EguiBridge
impl WithUserSignals for EguiBridge
Source§fn signals(&mut self) -> Self::SignalCollection<'_, Self>
fn signals(&mut self) -> Self::SignalCollection<'_, Self>
self. Read moreimpl You_forgot_the_attribute__godot_api for EguiBridge
Auto Trait Implementations§
impl !Freeze for EguiBridge
impl !RefUnwindSafe for EguiBridge
impl !Send for EguiBridge
impl !Sync for EguiBridge
impl !UnwindSafe for EguiBridge
impl Unpin for EguiBridge
impl UnsafeUnpin for EguiBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Inherits<T> for Twhere
T: GodotClass,
impl<T> Inherits<T> for Twhere
T: GodotClass,
Source§const IS_SAME_CLASS: bool = true
const IS_SAME_CLASS: bool = true
Self == Base. Read moreSource§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<C> ObjectToOwned<C> for Cwhere
C: WithBaseField,
impl<C> ObjectToOwned<C> for Cwhere
C: WithBaseField,
Source§fn object_to_owned(&self) -> Gd<C>
fn object_to_owned(&self) -> Gd<C>
Gd<T>.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.