Code: Select all
// head of the file before this
int main()
{
IrrlichtDevice* device = createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16, false, false, false, 0);
if (!device) return 1;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
ICameraSceneNode *camera = smgr->addCameraSceneNode();
MyEventReceiver receiver;
receiver.setCamera(camera);
camera->setPosition(vector3df(20, 50, -50));
camera->setTarget(vector3df(25, 35, -40));
device->setEventReceiver(&receiver);
// The rest doesn't matter
Code: Select all
//head of the file before this
void MyEventReceiver::setCamera(ICameraSceneNode *passedCamera)
{
intcamera = passedCamera;
}
bool MyEventReceiver::OnEvent (const SEvent& event)
{
float oldMousePos[2];
float newMousePos[] = {event.MouseInput.X, event.MouseInput.Y};
float mouseMove []= {newMousePos[0] - oldMousePos[0], newMousePos[1] - oldMousePos[1]};
if (event.EventType == irr::EET_KEY_INPUT_EVENT)
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
// if (event.EventType == EET_MOUSE_INPUT_EVENT)
// {
intcamera->setPosition(vector3df(-1000, -1000, -1000));
// }
return false;
}
// the rest doesn't matter
Thanks for the help though.


Off I go to perpetual debugging then...
