pub struct SDL2Backend {
pub sdl_context: Sdl,
pub event_pump: EventPump,
pub window: Window,
pub size_physical_pixels: [u32; 2],
pub scale: [f32; 2],
pub cursor_pos_physical_pixels: [f32; 2],
pub raw_input: RawInput,
pub frame_events: Vec<Event>,
pub gl_context: Option<GLContext>,
pub latest_resize_event: bool,
pub should_close: bool,
pub backend_settings: BackendSettings,
}
Fields§
§sdl_context: Sdl
§event_pump: EventPump
§window: Window
§size_physical_pixels: [u32; 2]
§scale: [f32; 2]
§cursor_pos_physical_pixels: [f32; 2]
§raw_input: RawInput
§frame_events: Vec<Event>
§gl_context: Option<GLContext>
§latest_resize_event: bool
§should_close: bool
§backend_settings: BackendSettings
Implementations§
Source§impl SDL2Backend
impl SDL2Backend
Trait Implementations§
Source§impl HasRawWindowHandle for SDL2Backend
impl HasRawWindowHandle for SDL2Backend
fn raw_window_handle(&self) -> RawWindowHandle
Source§impl OpenGLWindowContext for SDL2Backend
impl OpenGLWindowContext for SDL2Backend
Source§fn swap_buffers(&mut self)
fn swap_buffers(&mut self)
Swaps buffers (swapchain) when we are using double buffering (99% of the time, double buffering is the default)
this also flushes the opengl commands and blocks until the swapchain image is presented IF vsync is enabled.
Source§impl WindowBackend for SDL2Backend
impl WindowBackend for SDL2Backend
Source§type Configuration = SDL2Settings
type Configuration = SDL2Settings
This will be WindowBackend’s configuration. if necessary, just add Boxed closures as its
fields and run them before window creation, after window creation etc.. to provide maximum
configurability to users
Source§fn new(_config: Self::Configuration, backend_settings: BackendSettings) -> Selfwhere
Self: Sized,
fn new(_config: Self::Configuration, backend_settings: BackendSettings) -> Selfwhere
Self: Sized,
Create a new window backend. and return info needed for the GfxBackend creation and rendering
config is the custom configuration of a specific window backend
Source§fn take_raw_input(&mut self) -> RawInput
fn take_raw_input(&mut self) -> RawInput
This frame’s events gather into rawinput and to be presented to egui’s context
Source§fn run_event_loop<G: GfxBackend<Self>, U: UserApp<Self, G>>(
self,
gfx_backend: G,
user_app: U,
)
fn run_event_loop<G: GfxBackend<Self>, U: UserApp<Self, G>>( self, gfx_backend: G, user_app: U, )
Run the event loop. different backends run it differently, so they all need to take care and
call the Gfx or UserApp functions at the right time.
Source§fn get_live_physical_size_framebuffer(&mut self) -> [u32; 2]
fn get_live_physical_size_framebuffer(&mut self) -> [u32; 2]
sometimes, the frame buffer size might have changed and the event is still not received.
in those cases, wgpu / vulkan like render apis will throw an error if you try to acquire swapchain
image with an outdated size. you will need to provide the latest size for succesful creation of surface frame.
fn get_settings(&self) -> &BackendSettings
Auto Trait Implementations§
impl Freeze for SDL2Backend
impl RefUnwindSafe for SDL2Backend
impl !Send for SDL2Backend
impl !Sync for SDL2Backend
impl Unpin for SDL2Backend
impl UnwindSafe for SDL2Backend
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
Mutably borrows from an owned value. Read more