Struct ul_next::app::App

source ·
pub struct App { /* private fields */ }
Expand description

Main application struct.

Implementations§

source§

impl App

source

pub fn new( settings: Option<Settings>, config: Option<Config> ) -> Result<Self, CreationError>

Creates a new application instance.

§Arguments
  • settings - The settings to customize the app runtime behaviour.
  • config - Options for Ultralight Renderer.

Leaving settings or config as None will use the default settings/ config.

Returns None if the application could not be created.

source

pub fn settings(&self) -> &Settings

Get the settings of the app.

source

pub fn main_monitor(&self) -> &Monitor

Get the main monitor of the app.

source

pub fn is_running(&self) -> bool

Whether or not the app is running.

source

pub fn renderer(&self) -> &Renderer

Get the underlying Renderer instance.

source

pub fn set_update_callback<F>(&self, callback: F)
where F: FnMut() + 'static,

Set a callback to be called whenever the App updates. You should update all app logic here.

This event is fired right before the run loop calls Renderer::update and Renderer::render.

source

pub fn run(&self)

Start the main loop.

source

pub fn quit(&self)

Stop the main loop.

source

pub fn create_window( &self, width: u32, height: u32, fullscreen: bool, window_flags: WindowFlags ) -> Option<Window>

Create a new window.

§Arguments
  • width - The width of the window.
  • height - The height of the window.
  • fullscreen - Whether or not the window should be fullscreen.
  • window_flags - Various WindowFlags.

The window will be shown by default unless WindowFlags::hidden was set.

The window will be closed automatically if the object is dropped.

Returns None if the window could not be created.

Trait Implementations§

source§

impl Drop for App

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl UnwindSafe for App

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

§

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

§

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.