BRL.Hook: | Functions | Modinfo | Source |
Hook id | Description | Hook data |
---|---|---|
FlipHook | A Max2D Flip is about to occur | Null |
EmitEventHook | An event has been emitted by a call to EmitEvent | An event object |
Function AddHook( id,func:Object( id,data:Object,context:Object ),context:Object=Null,priority=0 ) | |
Returns | A hook object that can be used with the RemoveHook command. |
Description | Add a hook function. |
Information | Add a hook function to be executed when RunHooks is called with the specified hook id. |
Example | 'This function will be automagically called every Flip Function MyHook:Object( id,data:Object,context:Object ) Global count count:+1 If count Mod 10=0 Print "Flips="+count End Function 'Add our hook to the system AddHook FlipHook,MyHook 'Some simple graphics Graphics 640,480,0 While Not KeyHit( KEY_ESCAPE ) Cls DrawText MouseX()+","+MouseY(),0,0 Flip Wend |
Function AllocHookId() | |
Returns | An integer hook id. |
Description | Allocate a hook id. |
Information | The returned hook id can be used with AddHook, RunHooks and RemoveHook. |
Function RemoveHook( id,func:Object( id,data:Object,context:Object ),context:Object=Null ) | |
Description | Remove a hook function. |
Information | Removes the hook function specified by id, func and context. |
Function RunHooks:Object( id,data:Object ) | |
Returns | The data produced by the last hook function. |
Description | Run hook functions. |
Information | RunHooks runs all hook functions that have been added for the specified hook id. The first hook function is called with the provided data object. The object returned by this function is then passed as the data parameter to the next hook function and so on. Therefore, hook functions should generally return the data parameter when finished. |
Version | 1.01 |
---|---|
Author | Mark Sibly |
License | Blitz Shared Source Code |
Copyright | Blitz Research Ltd |
Modserver | BRL |
History | 1.01 Release |
History | Added Context parameter to RemoveHook function |