All pastes #595309 Raw Edit

flake

public cpp v1 · immutable
#595309 ·published 2007-06-29 13:14 UTC
rendered paste body
class MyEventReceiver : public IEventReceiver {	public:	IrrlichtDevice *device;	IVideoDriver* driver;	ISceneManager* smgr;	IGUIEnvironment *guienv;	IAnimatedMesh* mesh;	IAnimatedMeshSceneNode* node;	scene::ICameraSceneNode * camera;		MyEventReceiver()		{			u32 k = 0;			for (k = 0; k < sizeof(Keys) / sizeof(*Keys); ++k)				Keys[k] = false;		}		virtual bool OnEvent(SEvent event)		{			if (event.EventType == EET_KEY_INPUT_EVENT)			{				Keys[event.KeyInput.Key] = event.KeyInput.PressedDown;				return true;			}			if (event.EventType == EET_GUI_EVENT) {				s32 id = event.GUIEvent.Caller->getID();	//			IGUIEnvironment* env = device->getGUIEnvironment();			switch (event.GUIEvent.EventType) {				case EGET_BUTTON_CLICKED:					if ((id >= 101) && (id <= 116))					{						printf("\nhere reschg=%d", id);						device->closeDevice();						device =createDevice( video::EDT_OPENGL, dimension2d<s32>(800,600), 32, true);						id=0;						return true;					}				break;			}			}			return false;		}		bool isKeyPressed(EKEY_CODE key) const		{			return Keys[key];		}	private:		bool Keys[KEY_KEY_CODES_COUNT];};