Trait mterm::App [−][src]
pub trait App { fn tick(&mut self, tick_input: TickInput) -> TickResult; fn present(&self, present_input: PresentInput<'_>) -> PresentResult; }
Expand description
Application trait for hooking into the main loop of mterm
.
mterm
manages Winit
and wgpu
for you to provide an interface between
it and your application. The application author is required to implement 2
methods from the trait: tick
and present
.
tick
is called everytime an event is triggered in the main loop. It
receivs a TickInput
structure that contains various information such as
any key presses, mouse movements and clicks, and some stats. Using this
information the application can execute its logic. This method should also
return a TickResult
value to tell the main loop whether to continue or
stop and exit the application.
present
is called whenever the application is required to render itself.
mterm
provides the method with a few u32
arrays via a PresentInput
structure. These arrays can be mutated to change what appears in the
window. This method should return a PresentResult
to tell the main loop if
anything changed and needs to be rendered.
Required methods
fn tick(&mut self, tick_input: TickInput) -> TickResult
fn present(&self, present_input: PresentInput<'_>) -> PresentResult