Skip to content

Commit

Permalink
world.write_storage should be mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Chen-Wang authored Jul 4, 2020
1 parent e18829b commit ede5c02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions book/src/ui/state_interaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn on_start(&mut self, data: StateData<()>) {
let btn = world.create_entity()
.with(ui_transform)
.with(ui_text)
.with(Interactable)
.with(Interactable)
.build();
/* Saving the button in our state struct */
Expand Down Expand Up @@ -98,7 +98,7 @@ component to our button:
fn on_pause(&mut self, data: StateData<'_, GameData<'_, '_>>) {
let world = data.world;
let hiddens = world.write_storage::<Hidden>();
let mut hiddens = world.write_storage::<Hidden>();
if let Some(btn) = self.button {
let _ = hiddens.insert(btn, Hidden);
Expand All @@ -114,7 +114,7 @@ The same goes for `on_resume` if we actually want to redisplay the button:
fn on_resume(&mut self, data: StateData<'_, GameData<'_, '_>>) {
let world = data.world;
let hiddens = world.write_storage::<Hidden>();
let mut hiddens = world.write_storage::<Hidden>();
if let Some(btn) = self.button {
let _ = hiddens.remove(btn);
Expand Down

0 comments on commit ede5c02

Please sign in to comment.