I made a breakpoint at the Mouse Object line, but as soon as I tried to step into it, it hit an exception. I think it's because of the input manager not getting created properly and then it tries to create a mouse object using a non existent object.
An unhandled exception of type 'System.AccessViolationException' occurred in Reinforcement 1942.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
My code: void SharedOgreResources::startInputSystem(void)
{
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
//OIS::InputManager mgr;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
try
{
mInputManager = OIS::InputManager::createInputSystem(pl);
}
catch( OIS::Exception str)
{
str.eType;
}
//Create a simple keyboard
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, false));
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false));
unsigned int width, height, depth;
int top, left;
mWindow->getMetrics(width, height, depth, left, top);
const OIS::MouseState &ms = mMouse->getMouseState();
ms.width = width;
ms.height = height;
Ogre::LogManager::getSingletonPtr()->logMessage("Input System Created");
}EDIT: I put a breakpoint at the line "return im;" in the createInputSystem function and the variable "im" does seem to be valid. Now that I'm really looking at this, its not actually hitting an exception in the "createInputSystem()" function. It looks like what that "str" exception was the default values or something.