Struct SDL2Backend

Source
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

Source

pub fn tick(&mut self)

Trait Implementations§

Source§

impl HasRawWindowHandle for SDL2Backend

Source§

impl OpenGLWindowContext for SDL2Backend

Source§

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§

fn get_proc_address(&mut self, symbol: &str) -> *const c_void

get openGL function addresses.
Source§

impl WindowBackend for SDL2Backend

Source§

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) -> Self
where 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

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, )

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]

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.
Source§

fn get_settings(&self) -> &BackendSettings

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.