Hi all,
for some reason I want to use SDL (as window) and OIS (as inputsystem), working with LINUX.
I got the following error with the example attached (works fine without the createInputObject line).
Thanks for any hints and ideas!
HUG0
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 2 (X_ChangeWindowAttributes)
Serial number of failed request: 7
Current serial number in output stream: 9
#include <iostream>
#include <sstream>
//SDL
#include <SDL.h>
#include <SDL_syswm.h>
#include <SDL_opengl.h>
//OIS
#include <OISMouse.h>
#include <OISKeyboard.h>
#include <OISJoyStick.h>
#include <OISInputManager.h>
using namespace std;
int main()
{
//********* SDL ********
SDL_Surface* mp_screen;
size_t m_windowHandle;
int m_width = 800;
int m_height = 600;
// initialize the SDL library
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
cout << "Failed to initialize the SDL library: " << SDL_GetError() << endl;
SDL_WM_SetCaption("OIS SDL MOUSE test", NULL );
// create the window
int flags = SDL_OPENGL | SDL_RESIZABLE;
int bitsperpixel = 16;
mp_screen = SDL_SetVideoMode(m_width, m_height, bitsperpixel, flags );
// fill info variable to get handle
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
SDL_GetWMInfo(&info);
m_windowHandle = *( reinterpret_cast<std::size_t*>(&(info.info.x11.window)) );
//******* OIS ******
OIS::ParamList pl;
OIS::InputManager *mInputSystem;
OIS::Mouse *mMouse;
OIS::Keyboard *mKeyboard;
ostringstream windowHndStr;
windowHndStr << m_windowHandle;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
mInputSystem = OIS::InputManager::createInputSystem( pl );
mMouse = static_cast<OIS::Mouse*>(mInputSystem->createInputObject(OIS::OISMouse, false));
int wait;
cin >> wait;
return 0;
}