MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); gameScene = new GameScene(this); ui->gameView->setScene(gameScene); connect(ui->selectButton, SIGNAL(pressed()), this, SLOT(selectGame())); connect(ui->loadButton, SIGNAL(pressed()), this, SLOT(loadGame())); connect(ui->againButton, SIGNAL(pressed()), this, SLOT(againGame())); connect(ui->previousButton, SIGNAL(pressed()), this, SLOT(previousGame())); connect(ui->nextButton, SIGNAL(pressed()), this, SLOT(nextGame())); connect(ui->computeButton, SIGNAL(pressed()), this, SLOT(computeGame())); connect(ui->answerButton, SIGNAL(pressed()), this, SLOT(answerGame())); QSignalMapper *signalMapper = new QSignalMapper(this); connect(ui->actionEasy, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(ui->actionMedium, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(ui->actionHard, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(ui->actionEasy, 0); signalMapper->setMapping(ui->actionMedium, 1); signalMapper->setMapping(ui->actionHard, 2); connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(selectGame(int))); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(displayAbout())); gameNumber=-1; }
void ram(void) { int priv = GLOBAL(privacy); GLOBAL(privacy) = 3; config.nrmacs=1; config.maclen[0] = 32; config.channel = ANNOUNCE_CHANNEL; memcpy(config.mac0, ANNOUNCE_MAC, 5); nrf_config_set(&config); id = getRandom(); ctr = 1; while( selectGame() ){ playGame(); } GLOBAL(privacy) = priv; };
void LootState::init(const std::string& cmdLineGame) { // Do some preliminary locale / UTF-8 support setup here, in case the settings file reading requires it. //Boost.Locale initialisation: Specify location of language dictionaries. boost::locale::generator gen; gen.add_messages_path(LootPaths::getL10nPath().string()); gen.add_messages_domain("loot"); //Boost.Locale initialisation: Generate and imbue locales. locale::global(gen(Language(LanguageCode::english).GetLocale() + ".UTF-8")); boost::filesystem::path::imbue(locale()); // Check if the LOOT local app data folder exists, and create it if not. if (!fs::exists(LootPaths::getLootDataPath())) { BOOST_LOG_TRIVIAL(info) << "Local app data LOOT folder doesn't exist, creating it."; try { fs::create_directory(LootPaths::getLootDataPath()); } catch (exception& e) { initErrors_.push_back((format(translate("Error: Could not create LOOT settings file. %1%")) % e.what()).str()); } } if (fs::exists(LootPaths::getSettingsPath())) { try { LootSettings::load(LootPaths::getSettingsPath()); } catch (exception& e) { initErrors_.push_back((format(translate("Error: Settings parsing failed. %1%")) % e.what()).str()); } } //Set up logging. boost::log::add_file_log( boost::log::keywords::file_name = LootPaths::getLogPath().string().c_str(), boost::log::keywords::auto_flush = true, boost::log::keywords::format = ( boost::log::expressions::stream << "[" << boost::log::expressions::format_date_time< boost::posix_time::ptime >("TimeStamp", "%H:%M:%S") << "]" << " [" << boost::log::trivial::severity << "]: " << boost::log::expressions::smessage ) ); boost::log::add_common_attributes(); boost::log::core::get()->set_logging_enabled(isDebugLoggingEnabled()); // Log some useful info. BOOST_LOG_TRIVIAL(info) << "LOOT Version: " << LootVersion::major << "." << LootVersion::minor << "." << LootVersion::patch; BOOST_LOG_TRIVIAL(info) << "LOOT Build Revision: " << LootVersion::revision; #ifdef _WIN32 // Check if LOOT is being run through Mod Organiser. bool runFromMO = GetModuleHandle(ToWinWide("hook.dll").c_str()) != NULL; if (runFromMO) { BOOST_LOG_TRIVIAL(info) << "LOOT is being run through Mod Organiser."; } #endif // The CEF debug log is appended to, not overwritten, so it gets really long. // Delete the current CEF debug log. fs::remove(LootPaths::getLootDataPath() / "CEFDebugLog.txt"); // Now that settings have been loaded, set the locale again to handle translations. if (getLanguage().GetCode() != LanguageCode::english) { BOOST_LOG_TRIVIAL(debug) << "Initialising language settings."; Language lang(getLanguage()); BOOST_LOG_TRIVIAL(debug) << "Selected language: " << lang.GetName(); //Boost.Locale initialisation: Generate and imbue locales. locale::global(gen(lang.GetLocale() + ".UTF-8")); boost::filesystem::path::imbue(locale()); } // Detect games & select startup game //----------------------------------- //Detect installed games. BOOST_LOG_TRIVIAL(debug) << "Detecting installed games."; games_ = toGames(getGameSettings()); try { BOOST_LOG_TRIVIAL(debug) << "Selecting game."; selectGame(cmdLineGame); BOOST_LOG_TRIVIAL(debug) << "Initialising game-specific settings."; currentGame_->Init(true); // Update game path in settings object. storeGameSettings(toGameSettings(games_)); } catch (GameDetectionError& e) { initErrors_.push_back(e.what()); } catch (std::exception& e) { BOOST_LOG_TRIVIAL(error) << "Game-specific settings could not be initialised. " << e.what(); initErrors_.push_back((format(translate("Error: Game-specific settings could not be initialised. %1%")) % e.what()).str()); } BOOST_LOG_TRIVIAL(debug) << "Game selected is " << currentGame_->Name(); }
void debug(int INmode) { ClearScreen(); SDL_Flip(screen); selectGame(1); gameResetVars(); if (INmode==2) //ClearFullRows() { for (int i=0; i<AREA_HEIGHT+2; i++) { for (int j=0; j<AREA_WIDTH; j++) { area[j][i] = (rand()%15)-EMPTY_AREA; if (area[j][i]>EMPTY_AREA) area[j][i]=area[j][i]%3+1; } } drawBoard(); SDL_Delay(5000); clearFullRows(); SDL_Delay(250); drawBoard(); SDL_Delay(5000); } else if (INmode==3) //drawTetromino() { int tets,angl; for (tets=0; tets<7; tets++) { for (angl=0; angl<4; angl++) { ClearScreen(); drawTetromino(tets,(angl+2)%4,0,0,REAL_TET); SDL_Flip(screen); SDL_Delay(600); } } } else if (INmode==4) //peiceSetinto() { pieceCreate(COMING); tetUD=10; drawTetromino(currentPiece,currentRotate,tetLR,tetUD,REAL_TET); SDL_Delay(3000); drawBoard(); SDL_Delay(3000); pieceSetInto(currentPiece); drawBoard(); SDL_Delay(3000); debugInfo(0); } else if (INmode==5) //peiceCreate() { for (int i=0; i<10; i++) { pieceCreate(COMING); ClearScreen(); printf("c%d n%d n%d n%d\n",currentPiece,nextPiece[0],nextPiece[1],nextPiece[2]); SDL_Delay(100); } } else if (INmode==6) //gravity { pieceCreate(COMING); while(tetUD<AREA_HEIGHT) //off by 2? { ClearScreen(); //drawBoard(true); drawTetromino(currentPiece,currentRotate,tetLR,tetUD,REAL_TET); printf("y=%d",tetUD); SDL_Delay(1000); tetUD++; } } }