irrlichtEventReceiver.h

00001 
00002 // protect multiple inclusion
00003 #ifndef _IRRLICHTEVENTRECEIVER_H_INCLUDED_
00004 #define _IRRLICHTEVENTRECEIVER_H_INCLUDED_
00005 
00006 
00007 typedef ERR_TYPE (*irrlichtKeyEventCallback_TYPE)(EKEY_CODE);
00008 typedef ERR_TYPE (*irrlichtMouseButtonEventCallback_TYPE)(s32 x, s32 y, f32 wheel);
00009 typedef ERR_TYPE (*irrlichtMouseButtonReleaseEventCallback_TYPE)();
00010 typedef ERR_TYPE (*irrlichtMouseMoveEventCallback_TYPE)(s32 x, s32 y);
00011 
00012 
00013 /*
00014 To get events like mouse and keyboard input, or GUI events like 
00015 "the OK button has been clicked", we need an object wich is derived from the 
00016 IEventReceiver object. There is only one method to override: OnEvent() 
00017 This method will be called by the irrlicht engine when an event happened. 
00018 */
00019 class IrrlichtEventReceiver : public IEventReceiver
00020 {
00021 public:
00022         IrrlichtEventReceiver();
00023         ~IrrlichtEventReceiver();
00024 
00025         ERR_TYPE registerKeyEventCallback( irrlichtKeyEventCallback_TYPE anyCallBackFunction ); 
00026         ERR_TYPE registerMouseButtonLeftEventCallback( irrlichtMouseButtonEventCallback_TYPE anyCallBackFunction );
00027         ERR_TYPE registerMouseButtonLeftReleaseEventCallback( irrlichtMouseButtonReleaseEventCallback_TYPE anyCallBackFunction );
00028         ERR_TYPE registerMouseButtonLeftDoubleClickEventCallback( irrlichtMouseButtonEventCallback_TYPE anyCallBackFunction );
00029         ERR_TYPE registerMouseButtonRightEventCallback( irrlichtMouseButtonEventCallback_TYPE anyCallBackFunction );
00030         ERR_TYPE registerMouseButtonRightReleaseEventCallback( irrlichtMouseButtonReleaseEventCallback_TYPE anyCallBackFunction );
00031         ERR_TYPE registerMouseMoveEventCallback( irrlichtMouseMoveEventCallback_TYPE anyCallBackFunction );
00032 
00033         virtual bool OnEvent( SEvent event );
00034 
00035 private:
00036         irrlichtKeyEventCallback_TYPE                                   theOneToCallOnKeyEvent;
00037         irrlichtMouseButtonEventCallback_TYPE                   theOneToCallOnMouseButtonLeftEvent;
00038         irrlichtMouseButtonReleaseEventCallback_TYPE    theOneToCallOnMouseButtonLeftReleaseEvent;
00039         irrlichtMouseButtonEventCallback_TYPE                   theOneToCallOnMouseButtonLeftDoubleClickEvent;
00040         irrlichtMouseButtonEventCallback_TYPE                   theOneToCallOnMouseButtonRightEvent;
00041         irrlichtMouseButtonReleaseEventCallback_TYPE    theOneToCallOnMouseButtonRightReleaseEvent;
00042         irrlichtMouseMoveEventCallback_TYPE                             theOneToCallOnMouseMoveEvent;
00043         u32                                                                                             previousMouseButtonLeftClick;   // timeMS of last mouse click
00044 };
00045 
00046 
00047 #endif // #ifndef _IRRLICHTEVENTRECEIVER_H_INCLUDED_

Generated on Sun Dec 2 03:10:23 2007 for TableTop by  doxygen 1.5.4