int CStatsUtil::DoExportAll() { Poco::Path inpath(m_inputPath); Poco::Path outpath; if( m_outputPath.empty() ) { outpath = inpath.absolute().makeParent().append(DefExportAllDir); } else { outpath = Poco::Path(m_outputPath).makeAbsolute(); } GameStats gstats( m_inputPath, m_langconf ); gstats.Load(); //Test output path Poco::File fTestOut = outpath; if( ! fTestOut.exists() ) { cout << "Created output directory \"" << fTestOut.path() <<"\"!\n"; fTestOut.createDirectory(); } gstats.ExportAll(outpath.toString()); return 0; }
int CStatsUtil::DoImportGameStrings() { Poco::Path inpath(m_inputPath); Poco::Path outpath; if( m_outputPath.empty() ) throw runtime_error("Output path unspecified!"); if( utils::isFolder( m_outputPath ) ) { outpath = Poco::Path(m_outputPath).makeAbsolute().makeDirectory(); GameStats gstats( outpath.toString(), m_langconf ); gstats.AnalyzeGameDir(); gstats.ImportStrings( m_inputPath ); gstats.WriteStrings(); } else { outpath = Poco::Path(m_outputPath).makeAbsolute(); if( ! m_flocalestr.empty() ) { auto myloc = std::locale( m_flocalestr ); pmd2::filetypes::WriteTextStrFile( outpath.toString(), utils::io::ReadTextFileLineByLine( m_inputPath, myloc ), myloc ); } else { pmd2::filetypes::WriteTextStrFile( outpath.toString(), utils::io::ReadTextFileLineByLine(m_inputPath) ); } } return 0; }
static void showLoser(GameData &gd) { // This is what it would look like ... // // SDL_Rect pgameover = {120, 250, 0, 0}; // TTF_Font *font_game_over = // TTF_OpenFont("resources/fonts/Alias.ttf", 76); // SDL_Surface *game_over = TTF_RenderUTF8_Blended(font_game_over, // "Game Over, N00B", textColor); // SDL_BlitSurface(game_over, NULL, screen, &pgameover); // // --- // This is the horror { GameStats::_SDL_Rect gstats(120, 250, 0, 0); SDL_BlitSurface( TTF_RenderUTF8_Blended( TTF_OpenFont("./resources/fonts/Alias.ttf", 76), "Game Over, N00B", GameStats::_SDL_Color(0xff, 0xff, 0xff ) ), NULL, gd.screen, &gstats ); } register uint8_t waitin = 2000/20; while (--waitin) { SDL_Flip(gd.screen); SDL_Delay(20); } } // showLoser
int CStatsUtil::DoImportItemsData() { if( m_outputPath.empty() ) throw runtime_error("Output path is empty!"); if( !utils::isFolder( m_outputPath ) ) throw runtime_error("Output path doesn't exist, or isn't a directory!"); GameStats gstats( m_outputPath, m_langconf ); gstats.ImportItems( m_inputPath ); gstats.WriteItems( m_outputPath ); return 0; }