Static World Gen and Display for the Overworld (#5)
Co-authored-by: luckyturtledev <git@lukas1818.de> Reviewed-on: #5 Co-authored-by: Dominic <git@msrd0.de> Co-committed-by: Dominic <git@msrd0.de>
This commit is contained in:
parent
5a4451d6a7
commit
8143a99843
13 changed files with 928 additions and 21 deletions
30
src/game.rs
30
src/game.rs
|
@ -1,18 +1,40 @@
|
|||
use comfy::*;
|
||||
|
||||
use crate::{
|
||||
activities::{house, overworld, Activity},
|
||||
State
|
||||
};
|
||||
use comfy::EngineContext;
|
||||
use std::ops::Sub;
|
||||
|
||||
pub fn update(state: &mut State, engine: &mut EngineContext) {
|
||||
#[repr(i32)]
|
||||
pub enum ZLayer {
|
||||
MapMax = -1,
|
||||
Human = 0,
|
||||
Ghost = 1
|
||||
}
|
||||
|
||||
impl From<ZLayer> for i32 {
|
||||
fn from(value: ZLayer) -> Self {
|
||||
// safe because #[repr(i32)]
|
||||
value as i32
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub<i32> 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) {
|
||||
pub fn draw(state: &State, engine: &EngineContext<'_>) {
|
||||
match state.activity {
|
||||
Activity::House => house::draw(state, engine),
|
||||
Activity::Overworld => overworld::draw(state, engine)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue