Created
July 14, 2014 01:37
-
-
Save fkaa/ceb143c69ca1baea40c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub trait GameState { | |
| fn init(&mut self); | |
| fn update(&mut self, delta: f32); | |
| } | |
| struct IngameState { | |
| save: SaveDataStruct, | |
| current_map: TodoMap, | |
| entities: Vec<EntityStructOrTrait> | |
| } | |
| impl GameState for IngameState { | |
| pub fn init(&mut self) { | |
| self.current_map = Map::from_save(self.save); | |
| } | |
| pub fn update(&mut self, delta: f32) { | |
| for entity in self.entities { | |
| entity.update(delta); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment