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


C++ Controller::add_frame方法代码示例

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


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

示例1: key_press_event

/**
 * Handles key pressed event.
 *
 * - Up: increase playhead FPS
 * - Down: decrease playhead FPS
 * - Backscape: remove a frame
 * - Escape or f: toggle full screen mode
 * - Space: add a frame
 * - Page Up: choose next clip
 * - Page Down: choose previous clip
 * - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9: choose a clip
 * - Ctrl-q: quit
 * - r: clears the contents of the current clip
 * - Ctrl-e: export the current clip
 * - Ctrl-s: save the whole project
 * - period: toggle the layout
 * - Tab: changes the playback direction
 * - Caps_Lock: Toggle video grabbing on/off
 * - a: Toggles on/off the intervalometer
 * - k: increase intervalometer interval by 1 second
 * - j: decrease intervalometer interval by 1 second
 * - right: move writehead to the next image
 * - left: move writehead to the previous image
 * - return: move writehead to the last image
 * - semicolon: move writehead to the first image
 * - (): increase/decrease fading between images
 * - o: toggles onion skinning
 * - []: increase/decrease opacity of the live input image in the overlay layout.
 */
gboolean Gui::key_press_event(ClutterActor *stage, ClutterEvent *event, gpointer user_data)
{
    // TODO:2010-09-18:aalex:Use the accelerators to allow the user to configure the controls
    // TODO:2010-09-18:aalex:Use Clutter for mouse and keyboard controls (ClutterBindingPool)

    UNUSED(stage);
    guint keyval = clutter_event_get_key_symbol(event);
    ClutterModifierType state = clutter_event_get_state(event);
    bool shift_pressed = (state & CLUTTER_SHIFT_MASK ? true : false);
    bool ctrl_pressed = (state & CLUTTER_CONTROL_MASK ? true : false);
    bool caps_lock_on = (state & CLUTTER_LOCK_MASK ? false : true); // FIXME: caps lock seems on when its off and vice versa

    Gui *context = static_cast<Gui*>(user_data);
    Controller *controller = context->owner_->get_controller();
    bool verbose = context->owner_->get_configuration()->get_verbose();

    switch (keyval)
    {
        case CLUTTER_KEY_Caps_Lock:
        {
            if (caps_lock_on)
            {
                std::cout << "Caps_Lock on. Recording video." << std::endl;
                controller->enable_video_grabbing(true);
            } else {
                std::cout << "Caps_Lock off." << std::endl;
                controller->enable_video_grabbing(false);
            }
            break;
        }
        case CLUTTER_KEY_Up:
            controller->increase_playhead_fps();
            break;
        case CLUTTER_KEY_Down:
            controller->decrease_playhead_fps();
            break;
        //case CLUTTER_KEY_XXX:
        //    controller->set_current_clip_direction(DIRECTION_BACKWARD);
        //    break;
        //case CLUTTER_KEY_XXX:
        //    controller->set_current_clip_direction(DIRECTION_FORWARD);
        //    break;
        case CLUTTER_KEY_Tab:
            controller->change_current_clip_direction();
            break;
        case CLUTTER_KEY_period:
            //TODO:2010-08-27:aalex:Create Controller:toggle_layout
            context->toggle_layout();
            break;
        case CLUTTER_KEY_r:
            // Ctrl-r or just r?
            //if (event->state & CLUTTER_CONTROL_MASK)
            controller->clear_current_clip();
            break;
        case CLUTTER_KEY_BackSpace:
            controller->remove_frame();
            break;
        case CLUTTER_KEY_f:
        case CLUTTER_KEY_Escape:
            context->toggleFullscreen();
            break;
        case CLUTTER_KEY_space:
            controller->add_frame();
            break;
        case CLUTTER_KEY_Page_Up:
            controller->choose_previous_clip();
            break;
        case CLUTTER_KEY_Page_Down:
            controller->choose_next_clip();
            break;
        case CLUTTER_KEY_0:
//.........这里部分代码省略.........
开发者ID:AmineYaiche,项目名称:toonloop,代码行数:101,代码来源:gui.cpp


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