现在的位置: 首页 > 综合 > 正文

(CEGUI)如何响应热键

2013年08月25日 ⁄ 综合 ⁄ 共 558字 ⁄ 字号 评论关闭

//创建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;
}

抱歉!评论已关闭.