AddHook
This function adds a global hook. Hooks are callback functions that will be executed when certain events occur.
Syntax
- AddHook(int hookid, void* hook)
Parameters
- hookid: the ID of the hook to add.
- hook: a pointer to the hook function to add.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
void MyHook(char* error)
{
std::string s = std::string(error);
System::Print(s);
// -- set a breakpoint here and view the printed output
}
int main(int argc, const char *argv[])
{
//Add a hook
System::AddHook(System::DebugErrorHook, MyHook);
//Induce an error
Debug::Error("Something went wrong!");
return 0;
}