Rune Engine
Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
subject.h
1
9
#pragma once
10
11
#include <core.h>
12
#include <DataStructures/list.h>
13
#include <vector>
14
15
namespace
rune
{
16
17
class
Observer;
18
class
Signal;
19
20
class
RUNE_ENGINE
Subject
21
{
22
protected
:
24
void
sendSignal(
Signal
);
26
std::vector<Observer*>
observers
;
28
int
getNumObservers(
void
);
29
30
public
:
32
void
subscribe(
Observer
& newObserver);
34
bool
unsubscribe(
Observer
& newObserver);
35
36
};
37
38
}
//namespace rune
39
rune::Signal
Object that is used as a signal to notify observers of action.
Definition:
signal.h:19
rune::Observer
An interface that allows objects to watch a subject for signals, and perform some action when notifie...
Definition:
observer.h:18
rune::Subject
A subject that can be watched for signals by observers.
Definition:
subject.h:21
rune::Subject::observers
std::vector< Observer * > observers
List of observers currently subscribed to this object.
Definition:
subject.h:26
rune
The main namespace to be used for interfacing with the engine.
Definition:
animator.h:21
RuneEngine
src
Events
subject.h
Generated on Tue Feb 2 2021 12:53:34 for the Rune Engine with
1.8.18.