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


C++ ModifierKeys::isAnyModifierKeyDown方法代码示例

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


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

示例1: buttonClicked

void GuiPiano::buttonClicked(Button *button)
{
    
    //get modifier key so we can handle cmd-clicks when selecting keys
    ModifierKeys modifier = ModifierKeys::getCurrentModifiers();
    
    
	for (int i = 0; i <= 119; i++)
	{
        if (button == keys[i])
        {
            //=========================================================================
            //=========================================================================
            //regular click to set the selected midi pads note or sequencers pad root note
            if (modifier.isAnyModifierKeyDown() == false)
            {
                //first clear all keys
                for (int i = 0; i < 120; i++)
                    setKeyDisplay(i, false);
                selectedKeys.clear();
                
                
                for (int padIndex = 0; padIndex < selectedPads.size(); padIndex++)
                {
                    int padNum = selectedPads[padIndex];
                    
                    //=========================================================================
                    //MIDI MODE REG CLICK
                    if (PAD_SETTINGS->getMode() == 1) //Midi Mode
                    {
                        PAD_SETTINGS->setMidiNote(i);
                        
                        if (padIndex == 0)
                        {
                            setKeyDisplay (i, true);
                            selectedKeys.addIfNotAlreadyThere(i);
                            noteNumber = i;
                        }
                    }
                    
                    //=========================================================================
                    //SEQ MODE REG CLICK
                    else if (PAD_SETTINGS->getMode() == 3) //Sequencer Mode
                    {
                        
                        //get currently set 'root' note
                        int rootNote = PAD_SETTINGS->getSequencerMidiNote(0);
                        //get difference between root note and clicked note
                        int transposeValue = rootNote - i;
                        
                        //check to see if the top row of grid will be transposed
                        //to above 119. If so, don't transpose the notes, and just
                        //redraw/re-set what was last there in the below else statement
                        if (PAD_SETTINGS->getSequencerMidiNote(11)-transposeValue <= 119)
                        {
                            //add the transpose value to each note in the scale/set
                            for (int row = 0; row < 12; row++)
                            {
                                int currentVal = PAD_SETTINGS->getSequencerMidiNote(row);
                                
                                if (currentVal >= 0)
                                {
                                    int newVal = currentVal-transposeValue;
                                    
                                    PAD_SETTINGS->setSequencerMidiNote(newVal, row);
                                    
                                    //update the GUI
                                    if (padIndex == 0)
                                    {
                                        setKeyDisplay (newVal, true);
                                        selectedKeys.addIfNotAlreadyThere(newVal);
                                    }
                                    
                                    if (row == 0)
                                        noteNumber = i;
                                }
                                
                            }
                        }
                        else
                        {
                            //redraw and re-set what was previously there
                            //bit convoluted to clear everything above
                            //just to redraw it in a certain situation.
                            //Is there a better way to code it?
                            for (int row = 0; row < 12; row++)
                            {
                                if (padIndex == 0)
                                {
                                    setKeyDisplay (PAD_SETTINGS->getSequencerMidiNote(row), true);
                                    selectedKeys.addIfNotAlreadyThere(PAD_SETTINGS->getSequencerMidiNote(row));
                                }
                            }
                            
                        }
                        
                        recentlyUpdated = true;
                         
                    }
                }
//.........这里部分代码省略.........
开发者ID:ankit--sethi,项目名称:AlphaLive,代码行数:101,代码来源:GuiPiano.cpp


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