Skip to content

Instantly share code, notes, and snippets.

@peted70
Created June 4, 2018 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peted70/88417293fb30eeb78d5bcc6e7f4200e6 to your computer and use it in GitHub Desktop.
Save peted70/88417293fb30eeb78d5bcc6e7f4200e6 to your computer and use it in GitHub Desktop.
// I can declare a variable like this
subject<SceneManager const&> SceneChanged;
// subscribe for changes using an arbitrary function signature
sub_token RegisterForUpdates(function<void(SceneManager const&)> slot)
{
return SceneChanged.subscribe(slot);
}
// Then when changes happen, notify observers like this..
SceneChanged.notify(*this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment