use crate::{ activities::{house, overworld, Activity}, State }; use comfy::EngineContext; use std::ops::Sub; #[repr(i32)] pub enum ZLayer { MapMax = -1, Human = 0, Ghost = 1 } impl From for i32 { fn from(value: ZLayer) -> Self { // safe because #[repr(i32)] value as i32 } } impl Sub for ZLayer { type Output = i32; fn sub(self, other: i32) -> Self::Output { i32::from(self) - other } } pub fn update(state: &mut State, engine: &mut EngineContext<'_>) { match state.activity { Activity::House => house::update(state, engine), Activity::Overworld => overworld::update(state, engine) } } pub fn draw(state: &State, engine: &EngineContext<'_>) { match state.activity { Activity::House => house::draw(state, engine), Activity::Overworld => overworld::draw(state, engine) } }