tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

A `game_view`'s options can be updated #664

Closed TheoPannetier closed 1 year ago

TheoPannetier commented 1 year ago

Context

We can change (some) Options from the Options screen (options_view), great! But this currently has no effect on the options of the game run in game_view, because both are independent. To solve this, we need to update the options in game_view with those in options_view every time we switch to this screen.

Test

// (664) A game_view's options can be updated from options_view's
  {
    game_options options(0, true);
    view_manager vm(view_mode::options, options);
    assert(vm.get_game_view().get_options().is_playing_music());

    vm.get_options_view().click_play_music_button();
    vm.set_next_view(view_mode::game);
    assert(!vm.get_game_view().get_options().is_playing_music());
  }
TheoPannetier commented 1 year ago

Done, game_view's options are now updated every time the view is switched to it