AppLayer::Status PauseMenu::tick(std::vector<sf::Event> &e, const sf::Time &t, sf::Vector2f m) { for (unsigned i = 0; i < e.size(); i++) { //Mouse presses if (e[i].type == sf::Event::MouseButtonReleased) { if (e[i].mouseButton.button == sf::Mouse::Left) { float x = (float)e[i].mouseButton.x; float y = (float)e[i].mouseButton.y; unsigned opt = translateOption(x, y); if (!opt) continue; processChoice(); } else if (e[i].mouseButton.button == sf::Mouse::Right) { Layer::back(); break; } } //Mouse movement else if (e[i].type == sf::Event::MouseMoved) { float x = (float)e[i].mouseMove.x; float y = (float)e[i].mouseMove.y; unsigned opt = translateOption(x, y); if (!opt) continue; selectChoice(opt); } //Keyboard events else if (e[i].type == sf::Event::KeyPressed) { bool up = controller.pressing(GameController::K_UP, e[i].key.code); bool down = controller.pressing(GameController::K_DOWN, e[i].key.code); bool enter = controller.pressing(GameController::K_ENTER, e[i].key.code); bool esc = controller.pressing(GameController::K_ESCAPE, e[i].key.code); if (down) selectChoice(m_choice + 1); else if (up) selectChoice(m_choice - 1); else if (enter) processChoice(); else if (esc) { Layer::back(); break; } } } return AppLayer::HALT; }
SQLRETURN SQL_API SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) { #ifdef ODBCDEBUG ODBCLOG("SQLFreeStmt " PTRFMT " %s\n", PTRFMTCAST StatementHandle, translateOption(Option)); #endif if (!isValidStmt((ODBCStmt *) StatementHandle)) return SQL_INVALID_HANDLE; clearStmtErrors((ODBCStmt *) StatementHandle); return SQLFreeStmt_((ODBCStmt *) StatementHandle, Option); }
int runUic(int argc, char *argv[]) { qt_qhash_seed.testAndSetRelaxed(-1, 0); // set the hash seed to 0 if it wasn't set yet QCoreApplication app(argc, argv); QCoreApplication::setApplicationVersion(QString::fromLatin1(QT_VERSION_STR)); Driver driver; // Note that uic isn't translated. // If you use this code as an example for a translated app, make sure to translate the strings. QCommandLineParser parser; parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); parser.setApplicationDescription(QStringLiteral("Qt User Interface Compiler version %1").arg(QString::fromLatin1(QT_VERSION_STR))); parser.addHelpOption(); parser.addVersionOption(); QCommandLineOption dependenciesOption(QStringList() << QStringLiteral("d") << QStringLiteral("dependencies")); dependenciesOption.setDescription(QStringLiteral("Display the dependencies.")); parser.addOption(dependenciesOption); QCommandLineOption outputOption(QStringList() << QStringLiteral("o") << QStringLiteral("output")); outputOption.setDescription(QStringLiteral("Place the output into <file>")); outputOption.setValueName(QStringLiteral("file")); parser.addOption(outputOption); #ifdef QT_UIC_RUBY_GENERATOR QCommandLineOption execCodeOption(QStringList() << QStringLiteral("x") << QStringLiteral("exec-code")); execCodeOption.setDescription(QStringLiteral("exec code.")); parser.addOption(execCodeOption); QCommandLineOption useKDEOption(QStringList() << QStringLiteral("k") << QStringLiteral("use-kde")); useKDEOption.setDescription(QStringLiteral("use kde.")); parser.addOption(useKDEOption); #endif QCommandLineOption noProtOption(QStringList() << QStringLiteral("p") << QStringLiteral("no-protection")); noProtOption.setDescription(QStringLiteral("Disable header protection.")); parser.addOption(noProtOption); QCommandLineOption noImplicitIncludesOption(QStringList() << QStringLiteral("n") << QStringLiteral("no-implicit-includes")); noImplicitIncludesOption.setDescription(QStringLiteral("Disable generation of #include-directives.")); parser.addOption(noImplicitIncludesOption); QCommandLineOption postfixOption(QStringLiteral("postfix")); postfixOption.setDescription(QStringLiteral("Postfix to add to all generated classnames.")); postfixOption.setValueName(QStringLiteral("postfix")); parser.addOption(postfixOption); QCommandLineOption translateOption(QStringList() << QStringLiteral("tr") << QStringLiteral("translate")); translateOption.setDescription(QStringLiteral("Use <function> for i18n.")); translateOption.setValueName(QStringLiteral("function")); parser.addOption(translateOption); QCommandLineOption includeOption(QStringList() << QStringLiteral("include")); includeOption.setDescription(QStringLiteral("Add #include <include-file> to <file>.")); includeOption.setValueName(QStringLiteral("include-file")); parser.addOption(includeOption); QCommandLineOption generatorOption(QStringList() << QStringLiteral("g") << QStringLiteral("generator")); generatorOption.setDescription(QStringLiteral("Select generator.Default is ruby.")); generatorOption.setValueName(QStringLiteral("java|cpp|ruby")); parser.addOption(generatorOption); parser.addPositionalArgument(QStringLiteral("[uifile]"), QStringLiteral("Input file (*.ui), otherwise stdin.")); parser.process(app); driver.option().dependencies = parser.isSet(dependenciesOption); driver.option().outputFile = parser.value(outputOption); #ifdef QT_UIC_RUBY_GENERATOR driver.option().execCode = parser.isSet(execCodeOption); driver.option().useKDE = parser.isSet(useKDEOption); #endif driver.option().headerProtection = !parser.isSet(noProtOption); driver.option().implicitIncludes = !parser.isSet(noImplicitIncludesOption); driver.option().postfix = parser.value(postfixOption); driver.option().translateFunction = parser.value(translateOption); driver.option().includeFile = parser.value(includeOption); if (!parser.value(generatorOption).isEmpty()) driver.option().generator = (parser.value(generatorOption).toLower() == QLatin1String("java")) ? Option::JavaGenerator : Option::CppGenerator; QString inputFile; if (!parser.positionalArguments().isEmpty()) inputFile = parser.positionalArguments().first(); else // reading from stdin driver.option().headerProtection = false; if (driver.option().dependencies) { return !driver.printDependencies(inputFile); } QTextStream *out = 0; QFile f; if (driver.option().outputFile.size()) { f.setFileName(driver.option().outputFile); if (!f.open(QIODevice::WriteOnly | QFile::Text)) { fprintf(stderr, "Could not create output file\n"); return 1; } out = new QTextStream(&f); out->setCodec(QTextCodec::codecForName("UTF-8")); } bool rtn = driver.uic(inputFile, out); delete out; if (!rtn) { if (driver.option().outputFile.size()) { f.close(); f.remove(); } fprintf(stderr, "File '%s' is not valid\n", inputFile.isEmpty() ? "<stdin>" : inputFile.toLocal8Bit().constData()); } return !rtn; }