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


C++ GuiWindow::set_on_keydown方法代码示例

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


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

示例1: set_key

void Client::set_key(MappedKey::Device dev, int param) {
    set_key(dev, param, binding.left, PlayerKeyStateLeft);
    set_key(dev, param, binding.right, PlayerKeyStateRight);
    set_key(dev, param, binding.up, PlayerKeyStateUp);
    set_key(dev, param, binding.down, PlayerKeyStateDown);
    set_key(dev, param, binding.jump, PlayerKeyStateJump);
    set_key(dev, param, binding.fire, PlayerKeyStateFire);
    set_key(dev, param, binding.drop1, PlayerKeyStateDrop1);
    set_key(dev, param, binding.drop2, PlayerKeyStateDrop2);
    set_key(dev, param, binding.drop3, PlayerKeyStateDrop3);

    if (binding.chat.device == dev && binding.chat.param == param) {
        if (!get_stack_count()) {
            subsystem.clear_input_buffer();
            int vw = subsystem.get_view_width();
            int vh = subsystem.get_view_height();
            int ww = 350;
            int wh = 30;
            GuiWindow *window = push_window(1, 1, ww, wh, "Enter Message");
            window->set_on_keydown(static_window_keydown, this);
            window->set_on_joybuttondown(static_window_joybutton_down, this);
            ww = window->get_client_width();
            chat_textbox = create_textbox(window, Spc, Spc, ww - 2 * Spc, "");
            window->set_height(window->get_height() - window->get_client_height() + 2 * Spc + chat_textbox->get_height());
            window->set_x(vw / 2 - window->get_client_width() / 2);
            window->set_y(vh / 2 - window->get_client_height() / 2);
            chat_textbox->set_focus();
            if (me) {
                me->state.client_server_state.key_states = 0;
            }
        }
    }

    if (binding.stats.device == dev && binding.stats.param == param) {
        if (!get_stack_count()) {
            if (tournament) {
                tournament->show_stats(true);
            }
        }
    }

    if (binding.escape.device == dev && binding.escape.param == param) {
        show_options_menu();
    }
}
开发者ID:goatattack,项目名称:goatattack,代码行数:45,代码来源:Client.cpp

示例2: capture_key

void OptionsMenu::capture_key(GuiTextbox *ck_selected) {
    int vw = subsystem.get_view_width();
    int vh = subsystem.get_view_height();
    int ww = 200;
    int wh = 83;
    int bw = 140;

    this->ck_selected = ck_selected;

    GuiWindow *window = gui.push_window(vw / 2 - ww / 2, vh / 2- wh / 2, ww, wh, "Capturing");
    window->set_on_keydown(static_capture_keydown, this);
    window->set_on_joybuttondown(static_capture_joybuttondown, this);
    std::string text("Press key or use joystick...");
    Font *f = gui.get_font();
    int tw = f->get_text_width(text);
    int fh = f->get_font_height();
    gui.create_label(window, ww / 2 - tw / 2, window->get_client_height() / 2 - fh / 2 - 10, text);

    bw = 55;
    gui.create_button(window, ww / 2 - bw / 2, wh - 43, bw, 18, "Cancel", static_abort_capture_click, this);
}
开发者ID:goatattack,项目名称:goatattack,代码行数:21,代码来源:OptionsMenu.cpp


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