Heres the current Camera class source as to where I currently stand:
Code: Select all
#pragma once
#include "stdafx.h"
#include "irrlicht.h"
#include "MastEventReceiver.h"
class Camera
{
public:
ISceneManager* scene;
MastEventReceiver* input;
ISceneNode* parent;
ISceneNode* target;
ICameraSceneNode* cam;
float mouseX;
float mouseY;
float newMouseX;
float newMouseY;
bool reset;
Camera(ISceneManager* s, MastEventReceiver* i)
{
scene = s;
input = i;
target = scene->addEmptySceneNode(0,-1);
cam = scene->addCameraSceneNode(target,vector3df(100,0,0),vector3df(target->getRotation().X,
target->getRotation().Y,target->getRotation().Z),-1);
mouseX = 0;
mouseY = 0;
reset = true;
}
//void setParent(ISceneNode* node)
//{
// parent = node;
// updateLocation();
//}
//void updateLocation()
//{
//}
void run()
{
if(input->rightMouseDown())
{
if(input->mouseHasMoved())
{
if(reset)
{
mouseX = float(input->mouseX());
mouseY = float(input->mouseY());
reset = false;
}
newMouseX = mouseX - float(input->mouseX());
newMouseY = mouseY - float(input->mouseY());
target->setRotation(vector3df(target->getRotation().X,
target->getRotation().Y - newMouseX,
target->getRotation().Z - newMouseY));
mouseX = float(input->mouseX());
mouseY = float(input->mouseY());
}
}
if(input->rightMouseReleased())
{
reset = true;
}
}
};