Context as Activity member; on_destroy context is released

This commit is contained in:
ChristianVisintin
2020-11-29 11:33:59 +01:00
parent 00c81634ed
commit 7e085096c8
4 changed files with 168 additions and 87 deletions

View File

@@ -38,17 +38,19 @@ pub trait Activity {
///
/// `on_create` is the function which must be called to initialize the activity.
/// `on_create` must initialize all the data structures used by the activity
fn on_create(&mut self, context: &mut Context);
/// Context is taken from activity manager and will be released only when activity is destroyed
fn on_create(&mut self, context: Context);
/// ### on_draw
///
/// `on_draw` is the function which draws the graphical interface.
/// This function must be called at each tick to refresh the interface
fn on_draw(&mut self, context: &mut Context);
fn on_draw(&mut self);
/// ### on_destroy
///
/// `on_destroy` is the function which cleans up runtime variables and data before terminating the activity.
/// This function must be called once before terminating the activity.
fn on_destroy(&mut self, context: &mut Context);
/// This function finally releases the context
fn on_destroy(&mut self) -> Option<Context>;
}