Skip to content

Commit

Permalink
Implement Storage Abstraction
Browse files Browse the repository at this point in the history
This will allow us to implement save data and persistent settings such
as input mapping.
  • Loading branch information
zicklag committed Jul 13, 2022
1 parent 772591a commit 289d83a
Show file tree
Hide file tree
Showing 5 changed files with 434 additions and 12 deletions.
33 changes: 33 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ unic-langid = "0.9.0"
bevy_fluent = { git = "https://github.com/kgv/bevy_fluent", rev = "d41f514" }
sys-locale = "0.2.1"
fluent = "0.16.0"
directories = "4.0.1"
async-channel = "1.6.1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features=["Window", "Location"] }
web-sys = { version = "0.3", features=["Window","Location","Storage"] }

[features]
default = []
Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ enum GameStage {

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
enum GameState {
LoadingStorage,
LoadingGame,
MainMenu,
LoadingLevel,
Expand Down Expand Up @@ -192,7 +193,7 @@ fn main() {
)
.add_event::<ArrivedEvent>()
.add_event::<ThrowItemEvent>()
.add_loopless_state(GameState::LoadingGame)
.add_loopless_state(GameState::LoadingStorage)
.add_plugin(platform::PlatformPlugin)
.add_plugin(localization::LocalizationPlugin)
.add_plugin(RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100.0))
Expand All @@ -206,6 +207,7 @@ fn main() {
.add_plugin(UIPlugin)
.insert_resource(ParallaxResource::default())
.insert_resource(LeftMovementBoundary::default())
.add_system(platform::load_storage.run_in_state(GameState::LoadingStorage))
.add_system(game_init::load_game.run_in_state(GameState::LoadingGame))
.add_system(load_level.run_in_state(GameState::LoadingLevel))
.add_system_set(
Expand Down
Loading

0 comments on commit 289d83a

Please sign in to comment.