wgois / OIS

Official OIS repository. Object oriented Input System
https://wgois.github.io/OIS/
zlib License
254 stars 86 forks source link

SDL2 Integration? #62

Open hydexon opened 4 years ago

hydexon commented 4 years ago

Hi, i've noticed this an revived fork of the good ol' OIS input system, which i've used in OGRE long ago. and i want to ask if there's SDL2 integration because my project already uses it for windowing and some utility functions, and i saw the codebase there's SDL support in the repo, but i can't find some option switch in the CMake files.

There's some SDL2 support on the works, or still WIP? Thanks.

mathisloge commented 4 years ago

you can get it working with

        OIS::ParamList pl;
        SDL_SysWMinfo wmInfo;
        SDL_VERSION(&wmInfo.version);
        SDL_GetWindowWMInfo(window, &wmInfo);
        std::ostringstream wnd;
#if defined OIS_WIN32_PLATFORM
        HWND hwnd = (HWND)wmInfo.info.win.window;
        wnd << (size_t)hwnd;
#elif defined OIS_LINUX_PLATFORM
        Window lnx_win = (Window)wmInfo.info.x11.window;
        wnd << (size_t)lnx_win;
#else
#error "Unknown platform"
#endif
        pl.insert(std::make_pair(std::string("WINDOW"), wnd.str()));

Where window is a SDL_Window*

but I don't have a deeper integration into SDL itself. For my purposes this is enough