ocarina/libsaria/callback.cpp
Bryan Schumaker 33fe24fc64 Remove callbacks from libsaria class
These can easily exist as its own set of functions, and I want to remove
the libsaria class in the future.
2011-09-10 13:46:09 -04:00

22 lines
391 B
C++

#include <libsaria/libsaria.h>
#include <libsaria/callback.h>
#include <map>
using namespace std;
static map<callback_t, void (*)()> callbacks;
void trigger_callback(callback_t type)
{
map<callback_t, void (*)()>::iterator it;
it=callbacks.find(type);
if (it != callbacks.end())
it->second();
}
void register_callback(callback_t type, void (* func)())
{
callbacks[type] = func;
}