当前位置: 首页>>代码示例>>C++>>正文


C++ KeyEvent::getSource方法代码示例

本文整理汇总了C++中gcn::KeyEvent::getSource方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyEvent::getSource方法的具体用法?C++ KeyEvent::getSource怎么用?C++ KeyEvent::getSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gcn::KeyEvent的用法示例。


在下文中一共展示了KeyEvent::getSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: keyPressed

void ChatBox::keyPressed(gcn::KeyEvent& keyEvent){
    //if( keyEvent.isConsumed() ){ return; }

    //if enter pressed
    if( keyEvent.getKey().getValue() == gcn::Key::ENTER ){
        // on the input field
        if ( keyEvent.getSource() == inputField ){
            // add the text from the text field into the chat area
            push_back( inputField->getText(), DO_CALLBACK|PUT_USERNAME );
            //clear off the text field
            inputField->setText("");
        }
    }
}
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:14,代码来源:ChatBox.cpp

示例2: keyPressed

    void Menu::keyPressed(gcn::KeyEvent& keyEvent)
    {
        if (keyEvent.getKey().getValue() == gcn::Key::SPACE
            || keyEvent.getKey().getValue() == gcn::Key::LEFT_ALT
            || keyEvent.getKey().getValue() == gcn::Key::LEFT_CONTROL
            || keyEvent.getKey().getValue() == gcn::Key::ENTER
            && keyEvent.getSource() == this)
        {
            mGameSelectContainer->setVisible(true);
            mStartContainer->setVisible(false);
            mMainMultiSelector->requestFocus();

            //generateAction();
        }
        else if (keyEvent.getKey().getValue() == gcn::Key::ESCAPE)
        {
            init();

            //generateAction();
        }
    }
开发者ID:olofn,项目名称:db_public,代码行数:21,代码来源:menu.cpp

示例3: keyPressed

void Console::keyPressed(gcn::KeyEvent& keyEvent){
    //if( keyEvent.isConsumed() ){ return; };

    //if enter pressed
    if( keyEvent.getKey().getValue() == gcn::Key::ENTER ){
        // on the input field
        if ( keyEvent.getSource() == inputField ){
            // add the text from the text field into the text area
            push_back( inputField->getText(), DO_CALLBACK|PUT_USERNAME );
            //store command entered
            lastCommand = inputField->getText();
            //clear off the text field
            inputField->setText("");
            inputField->requestFocus();
        }
    } else
    if( keyEvent.getKey().getValue() == gcn::Key::UP ){
        if( lastCommand != "" ){
            inputField->setText(lastCommand);
            inputField->setCaretPosition( lastCommand.length() );
        }
    }
}
开发者ID:Infraelly,项目名称:old-infraelly-engine,代码行数:23,代码来源:Console.cpp


注:本文中的gcn::KeyEvent::getSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。