void rgbCellsFree () { int freeCells; char tempStr[256]; freeCells = cellsFree(); if (isFree (thePixel)) { sprintf (tempStr, "%d cells free including %ld",freeCells,thePixel); enableInput(); } else { sprintf (tempStr, "%d cells free but not %ld", freeCells, thePixel); disableInput(); } setLabel (freeLabel, tempStr); }
void MainWindow::onCheck() { std::string expression = ui->answer->text().toStdString(); Order* order = factory->get_order_in_progress(); std::vector<std::string> words = order->get_words(); if(factory->validateRegExp(expression, words)) { ui->answer->setText("You just made a panda happy :)"); factory->add_money(order->get_price()); factory->rating_increase(order->get_experience()); } else { ui->answer->setText("You just made a panda sad :("); factory->rating_decrease(order->get_experience()); } disableInput(); }
__interrupt void PORT4_VECTOR_ISR(void){ switch(P4IV) { case P4IV_P4IFG0: disableInput(); sw1_position = RELEASED; okay_to_look_at_switch1 = OKAY; count_debounce_SW1 = SET_0; PJOUT |=LED3; break; case P4IV_P4IFG1: disableInput(); sw2_position = RELEASED; okay_to_look_at_switch2 = OKAY; count_debounce_SW2 = SET_0; PJOUT |=LED3; default: break; } }
void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { CORO_BEGIN_CONTEXT; bool bRes; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); _ctx->bRes = false; if (type == 0) CORO_INVOKE_2(_opt.init, _bigBuf, _ctx->bRes); else if (type == 1) CORO_INVOKE_3(_opt.initLoadMenuOnly, _bigBuf, true, _ctx->bRes); else if (type == 2) CORO_INVOKE_2(_opt.initNoLoadSave, _bigBuf, _ctx->bRes); else if (type == 3) CORO_INVOKE_3(_opt.initLoadMenuOnly, _bigBuf, false, _ctx->bRes); else if (type == 4) CORO_INVOKE_3(_opt.initSaveMenuOnly, _bigBuf, false, _ctx->bRes); if (_ctx->bRes) { g_vm->pauseSound(true); disableInput(); _inv.endCombine(); _curActionObj = 0; _curAction = TA_GOTO; _point.setAction(_curAction); _point.setSpecialPointer(RMPointer::PTR_NONE); _point.setCustomPointer(NULL); enableMouse(); g_vm->grabThumbnail(); // Exists the IDLE to avoid premature death in loading _bMustEnterMenu = true; if (type == 1 || type == 2) { GLOBALS._bIdleExited = true; } else { CORO_INVOKE_0(_tony.stopNoAction); GLOBALS._bIdleExited = false; CoroScheduler.createProcess(exitAllIdles, &_nCurLoc, sizeof(int)); } } CORO_END_CODE; }
void MainWindow::onOrderTaken() { ui->answer->setText("^"); enableInput(); int id = factory->take_order(); if(id == -1) { ui->orderInfo->setText(""); disableInput(); } else { factory->remove_order(id); Order* order = factory->get_order_in_progress(); QStringList words; for (std::string word : order->get_words()) { words << QString(word.c_str()); } ui->orderInfo->setText(words.join(", ")); ui->takeOrder->setDisabled(true); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->storage->setWidgetResizable(true); signalMapper = new QSignalMapper(); shopSignalMapper = new QSignalMapper(); //signals std::map<std::string,int> storageItems; storage = new Storage(storageItems); factory = new Factory(storage, 0, 0, 1, 20, 10, 0, std::vector<Worker*>(), std::map<std::size_t, Order*>()); connect(ui->toggleMainViewButton, SIGNAL(clicked()), this, SLOT(toggleMainViews())); connect(factory, SIGNAL(moneyChanged(int)), this, SLOT(onMoneyChanged(int))); connect(factory, SIGNAL(orderCreated(int)), this, SLOT(onOrderCreated(int))); connect(factory, SIGNAL(orderRemoved(int)), this, SLOT(onOrderRemoved(int))); connect(factory, SIGNAL(ratingChanged(float)), this, SLOT(onRatingChanged(float))); connect(factory, SIGNAL(levelChanged(int)), this, SLOT(onLevelChanged(int))); connect(ui->takeOrder, SIGNAL(clicked()), this, SLOT(onOrderTaken())); connect(storage, SIGNAL(addedMaterial(std::string)), this, SLOT(onAddedMaterial(std::string))); connect(signalMapper, SIGNAL(mapped(QString)), this, SLOT(onTookMaterial(QString))); connect(ui->check, SIGNAL(clicked()), this, SLOT(onCheck())); connect(shopSignalMapper, SIGNAL(mapped(QString)), this, SLOT(onPartBought(QString))); connect(factory,SIGNAL(levelChanged(int)), this, SLOT(onLevelChanged(int))); disableInput(); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("\\w"); storage->add_material("[aeoui]"); storage->add_material("[aeoui]"); storage->add_material("[aeoui]"); storage->add_material(".?"); storage->add_material(".?"); storage->add_material(".?"); storage->add_material(".?"); storage->add_material(".?"); storage->add_material("\\d"); storage->add_material("\\d"); storage->add_material("\\d"); storage->add_material("\\d"); storage->add_material("[a-c]"); storage->add_material("[d-f]"); storage->add_material("[q-t]"); storage->add_material("[l-s]"); storage->add_material("[x-z]"); store = {{"( ͡° ͜ʖ ͡°)", 9001}, {"\\w", 2}, {"\\d", 2}, {"\\s", 2}, {"\\W", 2}, {"[abcdf]", 1}, {"[xyzt]", 1}, {"[qwerty]", 1}, {"[aeiouy]", 1}, {"[jklmn]", 1}, {"?", 5}, {"|", 5}, {".", 5}, {"+", 10}, {"*", 15}, {"[", 0},{"]", 0}}; ui->storageLayout->setContentsMargins(1, 1, 1, 1); populateStore(); onLevelChanged(1); }