void ofxSimpleGuiToo::nextPageWithBlank() { if(doDraw) { setPage(currentPageIndex + 1); if(currentPageIndex == 1) setDraw(false); } else { setDraw(true); setPage(1); } }
//更新 void Navigator::update(){ if(getNoteArrayCount() == 0){ return; } if(mNoteChanged){ if(checkNaviFlag()){ mDouble = checkDouble(); setDraw(mDouble); } }else{ if(!checkNaviFlag()){ mNoteArray->removeObjectAtIndex(0); mNaviSprite->setVisible(false); mIsHoldFirst = false; //同時押しの場合2つ目も削除 if(mDouble){ mNoteArray->removeObjectAtIndex(0); mNaviSpriteDouble->setVisible(false); mIsHoldSecond = false; } mNoteChanged = true; } } if(checkNaviFlag()){ //ホールドの更新 if(mIsHoldFirst){ updateHoldNavi(false); } if(mIsHoldSecond){ updateHoldNavi(true); } } }
void ofxSimpleGuiToo::setup() { config = &defaultSimpleGuiConfig; // guiFocus = 0; // xmlFilename = OFX_SIMPLEGUITOO_XML_NAME; doSave = false; // doSaveBackup = false; changePage = false; titleButton = NULL; headerPage = &addPage("Header"); headerPage->height = config->buttonHeight * 2; headerPage->width = 0; titleButton = &headerPage->addButton("title", changePage); headerPage->addToggle("Auto Save", doAutoSave); headerPage->addButton("Save Settings", doSave); // headerPage->addButton("Backup XML", doSaveBackup); headerPage->addFPSCounter(); addPage(); setAutoSave(true); setAlignRight(false); setDraw(false); setPage(1); ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed); }
//-------------------------------------------------------------- void Gui::keyPressed(int key) { if(!pages.size()) return; if(doDefaultKeys) { if(key == ' ') { toggleDraw(); } else if(key>='1' && key<='9') { setPage((int)(key - '1')+1); setDraw(true); } else if(doDraw) { switch(key) { case '[': prevPage(); break; case ']': nextPage(); break; } } } if(!doDraw) return; ofKeyEventArgs e; e.key = key; if(!getActiveControls().empty()) { getActiveControls()[0]->_keyPressed(e); } else { getCurrentPage().keyPressed(key); Container::keyPressed(key); } }
paintView::paintView(Datapool *i_data, QString afterModule, int col, int row, int m_vwidth):m_data(i_data), afterModule(afterModule){ this->column = col; this->row = row; this->indexView = row*m_vwidth + col; setDraw(); image = NULL; fnumber = 0; }
void ofxSimpleGuiToo::keyPressed(ofKeyEventArgs &e) { //ofLog(OF_LOG_VERBOSE, ofToString(e.key)); if(doDefaultKeys && keyboardShortcutsEnabled) { if(e.key == ' ') { toggleDraw(); /* disabled for keyboard editing } else if(e.key>='0' && e.key<='9') { setPage((int)(e.key - '0')); setDraw(true); */ } else if(doDraw) { switch(e.key) { case '[': prevPage(); break; case ']': nextPage(); break; //case 'p': focusPrev(); break; //case 'l': focusNext(); break; case 'g': setPage(1); setDraw(true); break; case 'G': gui.setAlignRight(!gui.getAlignRight()); break; case OF_KEY_UP: gui.currentPage().onKeyUp(); break; case OF_KEY_DOWN: //focusNext(); gui.currentPage().onKeyDown(); break; case OF_KEY_LEFT: gui.currentPage().onKeyLeft(); break; case OF_KEY_RIGHT: gui.currentPage().onKeyRight(); break; case OF_KEY_RETURN: gui.currentPage().onKeyEnter(); break; } } } // check and trigger keyboard shortcuts if(keyboardShortcutsEnabled){ map<int,ofxSimpleGuiEventTrigger*>::iterator it = keyboardShortcuts.find(e.key); if(it != keyboardShortcuts.end()){ //< if already exists it->second->trigger(); } } if(doDraw) { headerPage->keyPressed(e); pages[currentPageIndex]->keyPressed(e); } }
void PluginWindow::init(QString element) { GameElement::ElementType elemType; if (element == "white") { elemType = GameElement::TypeWhite; } else { elemType = GameElement::TypeBlack; } // Инициируем модель доски if (bmodel == NULL) { bmodel = new BoardModel(this); connect(bmodel, SIGNAL(changeGameStatus(GameModel::GameStatus)), this, SLOT(changeGameStatus(GameModel::GameStatus))); connect(bmodel, SIGNAL(setupElement(int, int)), this, SLOT(setupElement(int, int))); connect(bmodel, SIGNAL(lose()), this, SLOT(setLose()), Qt::QueuedConnection); connect(bmodel, SIGNAL(draw()), this, SLOT(setDraw()), Qt::QueuedConnection); connect(bmodel, SIGNAL(switchColor()), this, SIGNAL(switchColor())); connect(bmodel, SIGNAL(doPopup(const QString)), this, SIGNAL(doPopup(const QString))); }
void ofxSimpleGuiToo::keyPressed(ofKeyEventArgs &e) { if(doDefaultKeys) { if(e.key == ' ') { toggleDraw(); } else if(e.key>='0' && e.key<='9') { setPage((int)(e.key - '0')); setDraw(true); } else if(doDraw) { switch(e.key) { case '[': prevPage(); break; case ']': nextPage(); break; } } } if(doDraw) { headerPage->keyPressed(e); pages[currentPageIndex]->keyPressed(e); } }
void ofxSimpleGuiToo::setup() { config = &defaultSimpleGuiConfig; doSave = false; changePage = false; titleButton = NULL; headerPage = &addPage("Header"); headerPage->height = config->buttonHeight * 2; headerPage->width = 0; titleButton = &headerPage->addButton("title", changePage); headerPage->addToggle("Auto Save", doAutoSave); headerPage->addButton("Save Settings", doSave); headerPage->addFPSCounter(); addPage(); setAutoSave(true); setAlignRight(false); setDraw(false); setPage(1); ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed); }
//-------------------------------------------------------------- void Gui::hide() { setDraw(false); }
paintView::paintView(){ image = NULL; fnumber = 0; setDraw(); }
void ofxSimpleGuiToo::toggleDraw() { setDraw(!doDraw); }
//-------------------------------------------------------------- void Gui::toggleDraw() { setDraw(!doDraw); }
void ofxSimpleGuiToo::hide() { setDraw(false); }
void ofxSimpleGuiToo::show() { setDraw(true); }
/** * Обработка входящей станзы и вызов соответствующих методов */ bool GameSessions::processIncomingIqStanza(int account, const QDomElement &xml, const QString &acc_status, bool conf_priv) { const QString iq_type = xml.attribute("type"); if(iq_type == "set") { QDomElement childElem = xml.firstChildElement("create"); if(!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } Options *options = Options::instance(); if ((options->getOption(constDndDisable).toBool() && acc_status == "dnd") || (options->getOption(constConfDisable).toBool() && conf_priv)) { sendErrorIq(account, from, id, ""); return true; } if (incomingInvitation(account, from, childElem.attribute("color"), id)) { emit doInviteEvent(account, from, tr("%1: Invitation from %2").arg(constPluginName).arg(from), this, SLOT(showInvitation(QString))); } return true; } if (activeCount() == 0) // Нет ни одной активной игровой сессии (наиболее вероятный исход большую часть времени) return false; // Остальные проверки бессмысленны childElem = xml.firstChildElement("turn"); if (!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } QDomElement turnChildElem = childElem.firstChildElement("move"); if (!turnChildElem.isNull()) { return doTurnAction(account, from, id, turnChildElem.attribute("pos")); } turnChildElem = childElem.firstChildElement("resign"); if (!turnChildElem.isNull()) { return youWin(account, from, id); } turnChildElem = childElem.firstChildElement("draw"); if (!turnChildElem.isNull()) { return setDraw(account, from, id); } return false; } childElem = xml.firstChildElement("close"); if (!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } return closeRemoteGameBoard(account, from, id); } childElem = xml.firstChildElement("load"); if (!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } return remoteLoad(account, from, id, childElem.text()); } } else if (iq_type == "result") { if (doResult(account, xml.attribute("from"), xml.attribute("id"))) { return true; } } else if (iq_type == "error") { if (doReject(account, xml.attribute("from"), xml.attribute("id"))) { return true; } } return false; }
void ofxSimpleGuiToo::setup() { config = &defaultSimpleGuiConfig; doSave = false; changePage = false; titleButton = NULL; keyboardShortcutsEnabled = true; doDrawPageBoundary = false; headerPage = &addPage("Header"); headerPage->height = config->buttonHeight * 2; headerPage->width = 0; titleButton = &headerPage->addButton("title", changePage); headerPage->addToggle("Auto Save", doAutoSave); headerPage->addButton("Save Settings", doSave); headerPage->addFPSCounter(); cols = ceilf(ofGetWidth() / config->gridSize.x); rows = ceilf(ofGetHeight() / config->gridSize.y); addPage(); // default settings page addFPSCounter(); setAutoSave(true); setAlignRight(false); setDraw(false); //addToggle("", <#bool value#>) //addControl(*titleButton); page(1).addPageShortcut(addPage("Keyboard Shortcuts")); page(1).addPageShortcut(addPage("GUI")); //setPage("GUI"); addButton("save settings", doSave); addToggle("auto save", doAutoSave); //gui.addTitle("gui display"); gui.addTitle("controls"); string choices[] = {"simple","advanced","all"}; gui.addComboBox("display priority", ofxSimpleGuiPage::mainPriority, 3, choices); gui.addButton("collapse all", 't', this, &ofxSimpleGuiToo::closeAllTitles); gui.addButton("open all", 'T', this, &ofxSimpleGuiToo::openAllTitles); gui.addTitle("display mode"); string displayModeChoices[GUI_MODE_COUNT] = {"fixed","floating"}; addComboBox("display mode", displayMode, GUI_MODE_COUNT, displayModeChoices); gui.addTitle("floating parameters"); gui.addSlider("x", displayRect.x, 0, ofGetWidth()); gui.addSlider("y", displayRect.y, 0, ofGetHeight()); gui.addSlider("columns", cols, 1, 10); gui.addSlider("rows", rows, 5, 30); gui.addButton("reset", this, &ofxSimpleGuiToo::setDefaultDimensions); gui.addToggle("draw boundaries", doDrawPageBoundary); //gui.addSlider("gui width", displayRect.width, 256, ofGetWidth()); //gui.addSlider("gui height", displayRect.height, 256, ofGetHeight()); setPage(1); //addSlider("advanced gui", ofxSimpleGuiControl::mainPriority, 0, 2); ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed); }
//-------------------------------------------------------------- void Gui::show() { setDraw(true); }