Trait rokol::app::RApp[][src]

pub trait RApp {
    fn init(&mut self) { ... }
fn frame(&mut self) { ... }
fn cleanup(&mut self) { ... }
fn event(&mut self, _ev: &Event) { ... }
fn fail(&mut self, msg: &str) { ... } }
Expand description

rokol::app callbacks

All provided function callbacks will be called from the same thread, but this may be different from the thread where main was called.

Provided methods

Called once after the rendering surface, 3D API and swap chain have been initialized by sokol_app

Usually called 60 times per second

Called once after the user quits the application

Suitable place to implement “really quit?” diaglog.

The cleanup-callback isn’t guaranteed to be called on the web and mobile platforms.

Event handling

Do not call any 3D API rendering functions in the event callback function, since the 3D API context may not be active when the event callback is called (it may work on some platforms and 3D APIs, but not others, and the exact behaviour may change between sokol-app versions).

Called when a fatal error is encountered during start which doesn’t allow the program to continue

Providing a callback here gives you a chance to show an error message to the user. The default behaviour is SOKOL_LOG(msg)

Implementors