예제 #1
0
bool handleStaticAction(int key)
{
    if (key == KEY_F1)
    {
        handleContextMenuAction(DEBUG_GUI_CAM_FREE);
    }
    else if (key == KEY_F2)
    {
        handleContextMenuAction(DEBUG_GUI_CAM_NORMAL);
    }
    // TODO: create more keyboard shortcuts

    return false;
}
예제 #2
0
        void SceneTree::handleContextMenuMultiSelection(QMenu* menu, QPoint const& globalPos, uint32_t numSelected)
        {
            QMenu* submenu = menu->addMenu("Add Children");
            populateAddObjectSubmenu(submenu);

            menu->addSeparator();
            menu->addAction("Duplicate");
            menu->addAction("Rename")->setDisabled(true);
            menu->addAction("Delete");
            
            handleContextMenuAction(menu->exec(globalPos));
        }
예제 #3
0
        void SceneTree::handleContextMenuSingleSelection(QMenu* menu, QPoint const& globalPos)
        {
            QMenu* submenu = menu->addMenu("AddChild");
            populateAddObjectSubmenu(submenu);

            menu->addSeparator();
            menu->addAction("Duplicate");
            menu->addAction("Rename");
            menu->addAction("Delete");

            handleContextMenuAction(menu->exec(globalPos));
        }
예제 #4
0
/** Debug menu handling */
bool onEvent(const SEvent &event)
{
    // Only activated in artist debug mode
    if(!UserConfigParams::m_artist_debug_mode)
        return true;    // keep handling the events

    if(event.EventType == EET_MOUSE_INPUT_EVENT)
    {
        // Create the menu (only one menu at a time)
        if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN &&
             !g_debug_menu_visible)
        {
            irr_driver->getDevice()->getCursorControl()->setVisible(true);

            // root menu
            gui::IGUIEnvironment* guienv = irr_driver->getGUI();
            core::rect<s32> r(100, 50, 150, 500);
            IGUIContextMenu* mnu = guienv->addContextMenu(r, NULL);
            int graphicsMenuIndex = mnu->addItem(L"Graphics >",-1,true,true);

            // graphics menu
            IGUIContextMenu* sub = mnu->getSubMenu(graphicsMenuIndex);

            sub->addItem(L"Reload shaders", DEBUG_GRAPHICS_RELOAD_SHADERS );
            sub->addItem(L"Wireframe", DEBUG_GRAPHICS_WIREFRAME );
            sub->addItem(L"Mipmap viz", DEBUG_GRAPHICS_MIPMAP_VIZ );
            sub->addItem(L"Normals viz", DEBUG_GRAPHICS_NORMALS_VIZ );
            sub->addItem(L"SSAO viz", DEBUG_GRAPHICS_SSAO_VIZ );
            sub->addItem(L"RSM viz", DEBUG_GRAPHICS_RSM_VIZ);
            sub->addItem(L"RH viz", DEBUG_GRAPHICS_RH_VIZ);
            sub->addItem(L"GI viz", DEBUG_GRAPHICS_GI_VIZ);
            sub->addItem(L"Shadow viz", DEBUG_GRAPHICS_SHADOW_VIZ );
            sub->addItem(L"Light viz", DEBUG_GRAPHICS_LIGHT_VIZ );
            sub->addItem(L"Distort viz", DEBUG_GRAPHICS_DISTORT_VIZ );
            sub->addItem(L"Physics debug", DEBUG_GRAPHICS_BULLET_1);
            sub->addItem(L"Physics debug (no kart)", DEBUG_GRAPHICS_BULLET_2);
            sub->addItem(L"Bounding Boxes viz", DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ);
            sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET );

            mnu->addItem(L"Items >",-1,true,true);
            sub = mnu->getSubMenu(1);
            sub->addItem(L"Basketball", DEBUG_POWERUP_RUBBERBALL );
            sub->addItem(L"Bowling", DEBUG_POWERUP_BOWLING );
            sub->addItem(L"Bubblegum", DEBUG_POWERUP_BUBBLEGUM );
            sub->addItem(L"Cake", DEBUG_POWERUP_CAKE );
            sub->addItem(L"Parachute", DEBUG_POWERUP_PARACHUTE );
            sub->addItem(L"Plunger", DEBUG_POWERUP_PLUNGER );
            sub->addItem(L"Swatter", DEBUG_POWERUP_SWATTER );
            sub->addItem(L"Switch", DEBUG_POWERUP_SWITCH );
            sub->addItem(L"Zipper", DEBUG_POWERUP_ZIPPER );
            sub->addItem(L"Nitro", DEBUG_POWERUP_NITRO );

            mnu->addItem(L"Attachments >",-1,true, true);
            sub = mnu->getSubMenu(2);
            sub->addItem(L"Bomb", DEBUG_ATTACHMENT_BOMB);
            sub->addItem(L"Anvil", DEBUG_ATTACHMENT_ANVIL);
            sub->addItem(L"Parachute", DEBUG_ATTACHMENT_PARACHUTE);

            mnu->addItem(L"GUI >",-1,true, true);
            sub = mnu->getSubMenu(3);
            sub->addItem(L"Toggle GUI", DEBUG_GUI_TOGGLE);
            sub->addItem(L"Hide karts", DEBUG_GUI_HIDE_KARTS);
            sub->addItem(L"Top view", DEBUG_GUI_CAM_TOP);
            sub->addItem(L"Behind wheel view", DEBUG_GUI_CAM_WHEEL);
            sub->addItem(L"Behind kart view", DEBUG_GUI_CAM_BEHIND_KART);
            sub->addItem(L"Side of kart view", DEBUG_GUI_CAM_SIDE_OF_KART);
            sub->addItem(L"First person view (Ctrl + F1)", DEBUG_GUI_CAM_FREE);
            sub->addItem(L"Normal view (Ctrl + F2)", DEBUG_GUI_CAM_NORMAL);
            sub->addItem(L"Toggle smooth camera", DEBUG_GUI_CAM_SMOOTH);
            sub->addItem(L"Attach fps camera to kart", DEBUG_GUI_CAM_ATTACH);

            mnu->addItem(L"Change camera target >",-1,true, true);
            sub = mnu->getSubMenu(4);
            sub->addItem(L"To kart one", DEBUG_VIEW_KART_ONE);
            sub->addItem(L"To kart two", DEBUG_VIEW_KART_TWO);
            sub->addItem(L"To kart three", DEBUG_VIEW_KART_THREE);
            sub->addItem(L"To kart four", DEBUG_VIEW_KART_FOUR);
            sub->addItem(L"To kart five", DEBUG_VIEW_KART_FIVE);
            sub->addItem(L"To kart six", DEBUG_VIEW_KART_SIX);
            sub->addItem(L"To kart seven", DEBUG_VIEW_KART_SEVEN);
            sub->addItem(L"To kart eight", DEBUG_VIEW_KART_EIGHT);

            mnu->addItem(L"Font >",-1,true, true);
            sub = mnu->getSubMenu(5);
            sub->addItem(L"Dump glyph pages of fonts", DEBUG_FONT_DUMP_GLYPH_PAGE);
            sub->addItem(L"Reload all fonts", DEBUG_FONT_RELOAD);

            mnu->addItem(L"Adjust values", DEBUG_VISUAL_VALUES);

            mnu->addItem(L"Profiler", DEBUG_PROFILER);
            if (UserConfigParams::m_profiler_enabled)
                mnu->addItem(L"Toggle capture profiler report",
                             DEBUG_PROFILER_GENERATE_REPORT);
            mnu->addItem(L"Do not limit FPS", DEBUG_THROTTLE_FPS);
            mnu->addItem(L"Toggle FPS", DEBUG_FPS);
            mnu->addItem(L"Save replay", DEBUG_SAVE_REPLAY);
            mnu->addItem(L"Save history", DEBUG_SAVE_HISTORY);
            mnu->addItem(L"Print position", DEBUG_PRINT_START_POS);
            mnu->addItem(L"Adjust Lights", DEBUG_ADJUST_LIGHTS);
            mnu->addItem(L"Scripting console", DEBUG_SCRIPT_CONSOLE);

            g_debug_menu_visible = true;
            irr_driver->showPointer();
        }

        // Let Irrlicht handle the event while the menu is visible.
        // Otherwise in a race the GUI events won't be generated
        if(g_debug_menu_visible)
            return false;
    }

    if (event.EventType == EET_GUI_EVENT)
    {
        if (event.GUIEvent.Caller != NULL &&
            event.GUIEvent.Caller->getType() == EGUIET_CONTEXT_MENU )
        {
            IGUIContextMenu *menu = (IGUIContextMenu*)event.GUIEvent.Caller;
            s32 cmdID = menu->getItemCommandId(menu->getSelectedItem());

            if (event.GUIEvent.EventType == EGET_ELEMENT_CLOSED)
            {
                g_debug_menu_visible = false;
            }
            else if (event.GUIEvent.EventType == gui::EGET_MENU_ITEM_SELECTED)
            {
                return handleContextMenuAction(cmdID);
            }
            return false;
        }
    }
    return true;    // continue event handling
}   // onEvent