mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
# Integrated Actor Viewer and Actor Editor tools
ObjectManager: Removed ObjectTypes because it hasn't been used for years. Atlas: Fixed leak when saving with Xerces. Changed range of water shininess slider. Actor Editor: Relabelled "Freq" to "Ratio". Made modal dialogs use the correct parent. This was SVN commit r4376.
This commit is contained in:
@@ -1,6 +1,27 @@
|
||||
#ifndef OBSERVABLE_H__
|
||||
#define OBSERVABLE_H__
|
||||
|
||||
/*
|
||||
Wrapper around Boost.Signals to make watching objects for changes more convenient.
|
||||
|
||||
General usage:
|
||||
|
||||
Observable<int> variable_to_be_watched;
|
||||
...
|
||||
class Thing {
|
||||
ObservableScopedConnection m_Conn;
|
||||
Thing() {
|
||||
m_Conn = variable_to_be_watched.RegisterObserver(OnChange);
|
||||
}
|
||||
void OnChange(const int& var) {
|
||||
do_something_with(var);
|
||||
}
|
||||
}
|
||||
...
|
||||
variable_to_be_watched.NotifyObservers();
|
||||
|
||||
*/
|
||||
|
||||
#include <boost/signals.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
@@ -59,4 +80,13 @@ private:
|
||||
boost::signal<void (const T&)> m_Signal;
|
||||
};
|
||||
|
||||
class ObservableScopedConnections
|
||||
{
|
||||
public:
|
||||
void Add(const ObservableConnection& conn);
|
||||
~ObservableScopedConnections();
|
||||
private:
|
||||
std::vector<ObservableConnection> m_Conns;
|
||||
};
|
||||
|
||||
#endif // OBSERVABLE_H__
|
||||
|
||||
Reference in New Issue
Block a user