void Region::cursorUp(Cursor* c) { if ( c == palette->MostRecentCursorDown() ) { palette->SetMostRecentCursorDown(NULL); } if ( isButton() ) { if ( buttonTooDeep(c) ) { NosuchDebug("Ignoring button up, too deep!"); } else if ( palette->isButtonDown(name) != true ) { NosuchDebug("Ignoring button up, isButtonDown wasn't true!"); } else { NosuchDebug("REGION::BUTTONUP %s %s",name.c_str(),c->DebugBrief().c_str()); buttonUp(name); } } else if ( Palette::selector_check && _graphicBehaviour->isSelectorDown() ) { NosuchDebug(1,"REGION::CURSORUP WITH GRAPHIC SELECTOR %s",c->DebugBrief().c_str()); _graphicBehaviour->cursorUpWithSelector(c); } else if ( Palette::selector_check && _musicBehaviour->isSelectorDown() ) { NosuchDebug(1,"REGION::CURSORUP WITH MUSIC SELECTOR %s",c->DebugBrief().c_str()); _musicBehaviour->cursorUpWithSelector(c); } else { NosuchVector pos = c->curr_pos; palette->cursorUp(c); NosuchDebug(2,"REGION::CURSORUP %s",c->DebugBrief().c_str()); _graphicBehaviour->cursorUp(c); _musicBehaviour->cursorUp(c); } }
void Region::cursorDown(Cursor* c) { if ( isButton() ) { NosuchDebug(1,"Region cursorDown depth=%f",c->curr_depth); if ( buttonTooDeep(c) ) { NosuchDebug("Ignoring cursor_down for button, too deep! (%.4f)",c->curr_depth); } else { NosuchDebug("REGION::BUTTONDOWN %s now=%.3f sid=%d/%s area=%.4f", name.c_str(),Palette::now/1000.0f,c->sidnum(),c->sidsource().c_str(),c->area()); if ( c->area() < 0.0 ) { NosuchDebug("HEY!!!! area is negative!???"); } buttonDown(name); } } else if ( Palette::selector_check && _graphicBehaviour->isSelectorDown() ) { NosuchDebug(1,"REGION::CURSORDOWN WITH GRAPHIC SELECTOR %s",c->DebugBrief().c_str()); _graphicBehaviour->cursorDownWithSelector(c); } else if ( Palette::selector_check && _musicBehaviour->isSelectorDown() ) { NosuchDebug(1,"REGION::CURSORDOWN WITH MUSIC SELECTOR %s",c->DebugBrief().c_str()); _musicBehaviour->cursorDownWithSelector(c); } else { NosuchDebug(2,"REGION::CURSORDOWN %s",c->DebugBrief().c_str()); NosuchVector pos = c->curr_pos; palette->cursorDown(c); // NosuchDebug("cursorDown checking isSelectorDown() = %d",_graphicBehaviour->isSelectorDown()); _graphicBehaviour->cursorDown(c); _musicBehaviour->cursorDown(c); palette->SetMostRecentCursorDown(c); } }
void VCSlider::slotInputValueChanged(quint32 universe, quint32 channel, uchar value) { /* Don't let input data thru in design mode */ if (mode() == Doc::Design) return; if (inputSource() == QLCInputSource(universe, channel)) { if (isButton(universe, channel) == true) { // Check value here so that value == 0 won't end up in the else branch if (value > 0) slotTapButtonClicked(); } else { /* Scale from input value range to this slider's range */ float val; val = SCALE((float) value, (float) 0, (float) UCHAR_MAX, (float) m_slider->minimum(), (float) m_slider->maximum()); if (m_slider->invertedAppearance() == true) m_slider->setValue(m_slider->maximum() - (int) val); else m_slider->setValue((int) val); } } }
/*--------------------------/ Noボタン生成 /--------------------------*/ void StageSelectActionLayer::buttonNo(cocos2d::Layer* layer,Menu* menu){ auto buttonNo = MenuItemImage::create("Texture/GamePlay/GameScene/StageSelect/StageSelect_No.png", "Texture/GamePlay/GameScene/StageSelect/StageSelect_No.png", [ = ](Ref* sender) { layer->removeFromParent(); isButton(true); }); buttonNo->setPosition(900,300); buttonNo->setScale(1.2f); menu->addChild(buttonNo); }
void Region::cursorDrag(SpaceCursor* c) { if ( isButton() ) { // Buttons aren't dragged std::string bn = name; if ( palette()->isButtonDown(bn) != true ) { // This usually happens when the cursorDown is "too deep" NosuchDebug(2,"Hmmm, got cursorDrag for button=%s when _buttonDown=false?",bn.c_str()); } } else { _graphicBehaviour->cursorDrag(c); _musicBehaviour->cursorDrag(c); } }
void Region::processCursor(SpaceCursor* c, int downdragup) { if ( isButton() ) { DEBUGPRINT(("Region::processCursor BUTTON!")); switch ( downdragup ) { case CURSOR_DOWN: buttonDown(); break; case CURSOR_UP: buttonUp(); break; } } else { DEBUGPRINT(("Region::processCursor SURFACE!")); switch ( downdragup ) { case CURSOR_DOWN: cursorDown(c); break; case CURSOR_DRAG: cursorDrag(c); break; case CURSOR_UP: cursorUp(c); break; } } }
void Region::cursorUp(SpaceCursor* c) { if ( c == palette()->MostRecentSpaceCursorDown() ) { palette()->SetMostRecentSpaceCursorDown(NULL); } if ( isButton() ) { if ( buttonTooDeep(c) ) { NosuchDebug("Ignoring button up, too deep!"); } else if ( palette()->isButtonDown(name) != true ) { NosuchDebug("Ignoring button up, isButtonDown wasn't true!"); } else { buttonUp(); } } else { _graphicBehaviour->cursorUp(c); _musicBehaviour->cursorUp(c); } }
Cursor* Region::setCursor(int sidnum, std::string sidsource, int millinow, NosuchVector pos, double depth, double area, OutlineMem* om) { if ( pos.x < x_min || pos.x > x_max || pos.y < y_min || pos.y > y_max ) { NosuchDebug("Ignoring out-of-bounds cursor pos=%f,%f,%f\n",pos.x,pos.y); return NULL; } if ( isButton() ) { // double buttonMinArea = 0.6f; double buttonMinArea = params.minbuttonarea; double buttonMaxArea = 1.3f; if ( area < buttonMinArea ) { NosuchDebug(2,"Ignoring setCursor for button, area %f too small",area); return NULL; } if ( area > buttonMaxArea ) { NosuchDebug(2,"Ignoring setCursor for button, area %f too big",area); return NULL; } } Cursor* c = getCursor(sidnum,sidsource); if ( c != NULL ) { c->settargetpos(pos); c->set_target_depth(depth); c->setarea(area); c->setoutline(om); cursorDrag(c); } else { c = new Cursor(palette, sidnum, sidsource, this, pos, depth,area); c->setoutline(om); if ( cursorlist_lock_write() ) { _cursors.push_back(c); cursorlist_unlock(); cursorDown(c); } else { NosuchDebug("Region::setCursor unable to lock cursorlist"); } } c->touch(millinow); return c; }
void Region::cursorDown(SpaceCursor* c) { if ( isButton() ) { NosuchDebug(1,"Region cursorDown depth=%f",c->depth()); if ( buttonTooDeep(c) ) { NosuchDebug("Ignoring cursor_down for button, too deep! (%.4f)",c->depth()); } else { NosuchDebug("REGION::BUTTONDOWN %s now=%.3f sid=%d/%s area=%.4f", name.c_str(),Palette::now/1000.0f,c->sid,c->source.c_str(),c->area); if ( c->area < 0.0 ) { NosuchDebug("HEY!!!! area is negative!???"); } buttonDown(); } } else { _graphicBehaviour->cursorDown(c); _musicBehaviour->cursorDown(c); palette()->SetMostRecentSpaceCursorDown(c); } }
void Region::cursorDrag(Cursor* c) { if ( isButton() ) { // Buttons aren't dragged std::string bn = name; if ( palette->isButtonDown(bn) != true ) { // This usually happens when the cursorDown is "too deep" NosuchDebug(2,"Hmmm, got cursorDrag for button=%s when _buttonDown=false?",bn.c_str()); } } else if ( Palette::selector_check && _graphicBehaviour->isSelectorDown() ) { NosuchDebug(2,"REGION::CURSORDRAG WITH GRAPHIC SELECTOR %s",c->DebugBrief().c_str()); _graphicBehaviour->cursorDragWithSelector(c); } else if ( Palette::selector_check && _musicBehaviour->isSelectorDown() ) { NosuchDebug(2,"REGION::CURSORDRAG WITH MUSIC SELECTOR %s",c->DebugBrief().c_str()); _musicBehaviour->cursorDragWithSelector(c); } else { NosuchDebug(2,"REGION::CURSORDRAG %s",c->DebugBrief().c_str()); palette->cursorDrag(c); _graphicBehaviour->cursorDrag(c); _musicBehaviour->cursorDrag(c); } }
/*--------------------------/ ステージ選択時 /--------------------------*/ void StageSelectActionLayer::stageSelected(int tag){ //ローカルレイヤー生成 auto layer = Layer::create(); //メニュー母体生成 auto menu = Menu::create(); menu->setPosition( Vec2::ZERO ); //layer->addChild(menu); //各自追加 drawMask(layer); drawExplain(layer); buttonYes(layer,menu,tag); buttonNo(layer,menu); layer->addChild(menu); //タッチの無効化 isButton(false); //レイヤーに追加 this->addChild(layer); }
bool belongsTo(uint16_t scancode) const { return isHat(scancode) || isAxis(scancode) || isButton(scancode); }