123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- .. _func_event_addhook:
- =======
- AddHook
- =======
- AddHook -
- Description
- ===========
- .. code-block:: blitzmax
- AddHook( id,func:Object( id,data:Object,context:Object ),context:Object=Null,priority=0 )
- Add a hook function
- Add a hook function to be executed when #RunHooks is called with the specified hook @id.
- Parameters
- ==========
- Return Values
- =============
- A hook object that can be used with the #RemoveHook command.
- Examples
- ========
- .. code-block:: blitzmax
- '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
- See Also
- ========
|