2

我目前正在尝试在我的游戏引擎中重新编写 Ogre 和 SDL 之间的活页夹。最初我在这里使用 Ogre Wiki 中概述的方法 我最近将我的 SDL 版本更新到 1.3 并注意到“SDL_CreateWindowFrom()”函数调用并重新实现了我的绑定器以允许 Ogre 构建窗口,然后从 Ogre 获取 HWND 以传递到 SDL。

只制作了一个窗口,我看到一切都正确呈现,但是没有收集任何输入。我不知道为什么。这是我目前正在使用的代码(在 Windows 上):

OgreWindow = Ogre::Root::getSingleton().createRenderWindow(WindowCaption, Settings.RenderWidth, Settings.RenderHeight, Settings.Fullscreen, &Opts);
size_t Data = 0;
OgreWindow->getCustomAttribute("WINDOW",&Data);
SDLWindow = SDL_CreateWindowFrom(&Data);
SDL_SetWindowGrab(SDLWindow,SDL_TRUE);

我试过环顾四周,有很多人已经做到了某种程度的成功(例如这里这里)。但似乎没有人在实现这一点后对处理输入发表评论。

我最初认为可能由于 SDL 不拥有该窗口,因此默认情况下不会从该窗口收集输入,这是合理的。所以我搜索了 SDL API,只发现一个函数“SDL_SetWindowGrab()”似乎与输入捕获有关。但是调用它没有任何效果。

如何让 SDL 从我的 Ogre 制作的窗口中收集输入?

4

1 回答 1

3

It has been a while, but I figured I would put in the answer for others that may need it. It turned out to be a bug/incomplete feature in SDL 1.3. The "CreateWindowFrom" method wasn't originally intended to be used exclusively as an input handler. At the time of this writing I know myself and another on my team wrote patches for Windows and Linux that permitted this use to work and submitted those patches to SDL.

于 2013-05-13T18:21:03.323 回答