(CEGUI)如何响应热键

//创建ROOT,

 

 window* d_root = d_wm->createWindow("WindowsLook/Static");
 d_root->setProperty("FrameEnabled", "false");
 // 响应热键
 d_root->subscribeEvent(Window::EventKeyDown, Event::Subscriber(&ScrollablePaneSample::hotkeysHandler, this));
System::getSingletonPtr()->setGUISheet(d_root);

 

 

//响应的回调函数

bool hotkeysHandler(const CEGUI::EventArgs& e)
{
    using namespace CEGUI;
    const KeyEventArgs& k = static_cast<const KeyEventArgs&>(e);

    switch (k.scancode)
    {
        case Key::Space:
              demoNewDialog(e);
              break;

        default:
        return false;
    }

    return true;
}

你可能感兴趣的:((CEGUI)如何响应热键)