bool Cx_StringTable::GetValue(std::wstring& value, const std::wstring& module, const std::wstring& id) { if (!m_loaded) { LoadFiles(x3::GetTranslationsPath(L"strings")); LoadFiles(x3::RelToAbsWithPlugin(L"../translations/strings", false)); } IT_ITEM it = Find(module); value.resize(0); if (it != m_groups.end()) { Cx_ConfigSection group(it->group); ASSERT(group.IsNotNull()); Cx_ConfigSection sec(group.GetSection(L"string", L"id", id.c_str(), false)); value = sec->GetString(L"value"); ReplaceLf(value); } return !value.empty(); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, #ifdef _WIN32_WCE LPWSTR lpCmdLine, #else LPSTR lpCmdLine2, #endif int nCmdShow) #endif { #ifdef WIN32 CommonInterface::hInst = hInstance; PaintWindow::register_class(hInstance); #endif LoadFiles(); CreateDefaultTask(task_manager, way_points); SingleWindow main_window; main_window.set(_T("STATIC"), _T("RunTaskEditorDialog"), 0, 0, 640, 480); ((Window &)main_window).install_wndproc(); main_window.show(); Layout::Initialize(640, 480); Fonts::Initialize(); dlgTaskOverviewShowModal(main_window); return 0; }
void shade::Component::setup(FileAccumulator& acc, PipelineState ps) { m_pipeline_state = ps; // First clean attribute list. std::for_each(m_attributes.begin(), m_attributes.end(), bind(&boost::signals::connection::disconnect, bind(&TypeState::connection, bind(&attribute_map::value_type::second, _1) ))); m_attributes.clear(); // Now collect all attributes and connect notifiers m_objects.add_object(get_pointer(m_shader)); CollectObjectInstances collect_instances(m_objects, bind(&Component::add_attribute, this, _1, _2, _3, _4), bind(&Component::get_type_state, this, _1) ); collect_instances(get_pointer(m_shader)); m_requires_upload = true; // Then find unique classes of these objects for (ObjectMap::Index i = 0; i != m_objects.get_next_index(); ++i) { m_objects[i]->traverse_hierarchy(SortClasses(m_classbins, i)); } // Load source files std::for_each(m_classbins.begin(), m_classbins.end(), LoadFiles(acc, m_objects)); m_sources = acc.get_str(); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine2, int nCmdShow) #endif { InitialiseDataPath(); ScreenGlobalInit screen_init; LoadFiles(); CreateDefaultTask(task_manager, way_points); SingleWindow main_window; main_window.set(_T("STATIC"), _T("RunTaskEditorDialog"), 0, 0, 640, 480); main_window.Show(); Fonts::Initialize(); dlgTaskOverviewShowModal(main_window); Fonts::Deinitialize(); DeinitialiseDataPath(); return 0; }
static void Main() { const Waypoints way_points; InterfaceBlackboard blackboard; blackboard.SetComputerSettings().SetDefaults(); blackboard.SetComputerSettings().polar.glide_polar_task = GlidePolar(fixed(1)); blackboard.SetUISettings().SetDefaults(); TaskBehaviour task_behaviour; task_behaviour.SetDefaults(); TaskManager task_manager(task_behaviour, way_points); task_manager.SetGlidePolar(blackboard.GetComputerSettings().polar.glide_polar_task); GlideComputerTaskEvents task_events; task_manager.SetTaskEvents(task_events); Airspaces airspace_database; ProtectedTaskManager protected_task_manager(task_manager, blackboard.GetComputerSettings().task); LoadFiles(airspace_database); const TaskFactoryType task_type_default = blackboard.GetComputerSettings().task.task_type_default; OrderedTask *task = protected_task_manager.TaskCreateDefault(&way_points, task_type_default); if (task != nullptr) { protected_task_manager.TaskCommit(*task); delete task; } GlideComputer glide_computer(way_points, airspace_database, protected_task_manager, task_events); glide_computer.ReadComputerSettings(blackboard.GetComputerSettings()); glide_computer.SetTerrain(terrain); glide_computer.SetContestIncremental(false); glide_computer.Initialise(); LoadReplay(replay, glide_computer, blackboard); delete replay; SingleWindow main_window; main_window.Create(_T("RunAnalysis"), {640, 480}); dlgAnalysisShowModal(main_window, *look, blackboard, glide_computer, &protected_task_manager, &airspace_database, terrain); delete terrain; }
bool wxSTEditorNotebook::LoadFiles( const wxArrayFileName* fileNames, const wxString &extensions) { if (fileNames != NULL) { wxArrayString filePaths; size_t n, count = fileNames->GetCount(); for (n = 0; n < count; n++) { filePaths.Add(fileNames->Item(n).GetFullPath()); } return LoadFiles(&filePaths, extensions); } return LoadFiles((wxArrayString*)NULL, extensions); // use file dialog to ask user }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, #ifdef _WIN32_WCE LPWSTR lpCmdLine, #else LPSTR lpCmdLine2, #endif int nCmdShow) #endif { Airspaces airspace_database; AirspaceWarningManager airspace_warning(airspace_database); airspace_warnings = new ProtectedAirspaceWarningManager(airspace_warning); InitialiseDataPath(); ScreenGlobalInit screen_init; #ifdef WIN32 ResourceLoader::Init(hInstance); #endif LoadFiles(airspace_database); Fonts::Initialize(); Airspaces::AirspaceTree::const_iterator it = airspace_database.begin(); AirspaceInterceptSolution ais; for (unsigned i = 0; i < 5 && it != airspace_database.end(); ++i, ++it) airspace_warning.GetWarning(*it->get_airspace()) .UpdateSolution((AirspaceWarning::State)i, ais); SingleWindow main_window; main_window.set(_T("STATIC"), _T("RunAirspaceWarningDialog"), 0, 0, 640, 480); main_window.show(); Layout::Initialize(640, 480); Fonts::Initialize(); DialogLook dialog_look; dialog_look.Initialise(Fonts::map_bold, Fonts::map, Fonts::map_bold, Fonts::map_bold); SetXMLDialogLook(dialog_look); dlgAirspaceWarningsShowModal(main_window, *airspace_warnings); Fonts::Deinitialize(); DeinitialiseDataPath(); delete airspace_warnings; return 0; }
int main(int argc, char* args[]) { if(SDL_Init(SDL_INIT_VIDEO) < 0) { //This is a nice alternative to printf in SDL 2 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "SDL", "SDL failed to initialize!", NULL); SDL_Quit(); return 0; } //In SDL 2, SDL_SetVideoMode has been removed, we now create windows using SDL_CreateWindow to create windows Window = SDL_CreateWindow("I can talk!", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN); //SDL_GetWindowSurface gets the backbuffer of the window we created with SDL_CreateWindow Backbuffer = SDL_GetWindowSurface(Window); if(!LoadFiles()) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "SDL", SDL_GetError(), NULL); //SDL_DestroyWindow destroys a window we created with SDL_CreateWindow SDL_DestroyWindow(Window); FreeFiles(); SDL_Quit(); return 0; } while(ProgramIsRunning()) { DrawImage(Background,Backbuffer, 0, 0); DrawRasterText(FontImage, Backbuffer, "All Systems Go!" , 100, 100, charSize); DrawRasterText(FontImage, Backbuffer, "Drawing Fonts is Fun!", 100, 116, charSize); SDL_Delay(20); //In SDL 2, SDL_UpdateWindowSurface replaces SDL_Flip SDL_UpdateWindowSurface(Window); } FreeFiles(); //SDL_DestroyWindow destroys a window we created with SDL_CreateWindow SDL_DestroyWindow(Window); SDL_Quit(); return 0; }
bool CInstance_Menu_MJ_Online::Init() { if(!LoadFiles()) return false; SDL_Rect cajas = {100, 200, 180, 25}; botones = new CBoton[3]; botones[0] = CBoton(ttf_consolas, &color_negro, &color_blanco, &cajas, "Crear Partida");cajas.y += 30; botones[1] = CBoton(ttf_consolas, &color_negro, &color_blanco, &cajas, "Unirse a Partida");cajas.y += 30; botones[2] = CBoton(ttf_consolas, &color_negro, &color_blanco, &cajas, "Volver"); menu = new CMenu(botones, 3); i_running = true; botones = new CBoton[4]; return true; }
bool CInstance_Menu_MJ::Init() { if(!LoadFiles()) return false; SDL_Rect cajas = {100, 200, 180, 25}; botones = new CBoton[4]; botones[0] = CBoton(ttf_consolas, &color_negro, &color_blanco, &cajas, "VS Local");cajas.y += 30; botones[1] = CBoton(ttf_consolas, &color_negro, &color_blanco, &cajas, "VS Online");cajas.y += 30; botones[2] = CBoton(ttf_consolas, &color_negro, &color_blanco, &cajas, "VS Máquina");cajas.y += 30; botones[3] = CBoton(ttf_consolas, &color_negro, &color_blanco, &cajas, "Volver"); menu = new CMenu(botones, 4); i_running = true; botones = new CBoton[4]; return true; }
static void Main() { Airspaces airspace_database; AirspaceWarningManager airspace_warning(airspace_database); airspace_warnings = new ProtectedAirspaceWarningManager(airspace_warning); LoadFiles(airspace_database); Airspaces::AirspaceTree::const_iterator it = airspace_database.begin(); AirspaceInterceptSolution ais; for (unsigned i = 0; i < 5 && it != airspace_database.end(); ++i, ++it) airspace_warning.GetWarning(it->GetAirspace()) .UpdateSolution((AirspaceWarning::State)i, ais); dlgAirspaceWarningsShowModal(*airspace_warnings); delete airspace_warnings; }
GraficosSDL::GraficosSDL(){ screen = NULL; fondo = NULL; pared = NULL; cuerpo = NULL; cabeza_arriba = NULL; cabeza_abajo = NULL; cabeza_derecha = NULL; cabeza_izquierda = NULL; manzana = NULL; gameover =NULL; soundtrack=NULL; cyber=NULL; if (! Init()) exit(-1); if (! LoadFiles()) exit(-1); }
int InitGame() { //Init SDL if(!InitSDL()) return 0; //Load Files if(!LoadFiles()) return 0; //Initiatialize game variables //Set scores to 0 PlayerScore = 0; EnemyScore = 0; //This can also set the initial variables ResetGame(); //Play Music Mix_PlayMusic(GameMusic, -1); return 1; }
void FuncDefs::Load() { Clear(); LoadFiles(); ParseDefs(); }
bool wxSTEditorNotebook::HandleMenuEvent(wxCommandEvent &event) { wxSTERecursionGuard guard(m_rGuard_HandleMenuEvent); if (guard.IsInside()) return false; int n_page = (int)GetPageCount(); int win_id = event.GetId(); switch (win_id) { case wxID_NEW: { NewPage(); return true; } case wxID_OPEN: { LoadFiles(); return true; } case wxID_SAVEAS: { wxSTEditor *editor = GetEditor(); if (!editor) return true; // event handled, but we couldn't do anything with it. if (!editor->IsFileFromDisk()) { editor->SaveFile(true); } else { wxFileName selectedFileName; wxString selectedFileEncoding; bool selected_file_bom = false; bool ok = editor->SaveFileDialog(true, wxEmptyString, &selectedFileName, &selectedFileEncoding, &selected_file_bom); if (!ok) return true; // they probably canceled the dialog if (selectedFileName == editor->GetFileName()) { // They want to save to the same filename, update current editor. editor->SaveFile(selectedFileName, selectedFileEncoding, selected_file_bom); return true; } else { // Make a new editor for the new filename, leave the original editor as is. wxSTEditorSplitter *splitter = CreateSplitter(wxID_ANY); wxCHECK_MSG(splitter, true, wxT("Invalid splitter")); wxSTEditor *newEditor = splitter->GetEditor(); wxCHECK_MSG(newEditor, true, wxT("Invalid splitter editor")); // Make this new editor identical to the original one // these are probably not necessary //splitter->GetEditor()->SetOptions(editor->GetOptions()); //splitter->GetEditor()->RegisterPrefs(editor->GetEditorPrefs()); //splitter->GetEditor()->RegisterStyles(editor->GetEditorStyles()); //splitter->GetEditor()->RegisterLangs(editor->GetEditorLangs()); newEditor->SetLanguage(editor->GetLanguageId()); newEditor->SetFileName(editor->GetFileName()); newEditor->SetFileEncoding(editor->GetFileEncoding()); newEditor->SetFileBOM(editor->GetFileBOM()); newEditor->SetText(editor->GetText()); newEditor->ColouriseDocument(); newEditor->GotoPos(editor->PositionFromLine(editor->LineFromPosition(editor->GetCurrentPos()))); newEditor->GotoPos(editor->GetCurrentPos()); newEditor->ScrollToLine(editor->GetFirstVisibleLine()); // if we can save it, then add it to the notebook if (newEditor->SaveFile(selectedFileName, selectedFileEncoding, selected_file_bom)) { if (!InsertEditorSplitter(-1, splitter, true)) splitter->Destroy(); } else splitter->Destroy(); // problem saving, delete new editor } } return true; } case ID_STN_SAVE_ALL: { SaveAllFiles(); return true; } case ID_STN_CLOSE_PAGE: { if ((GetSelection() != -1) && GetEditor(GetSelection())) { ClosePage(GetSelection(), true); } return true; } case ID_STN_CLOSE_ALL: { if (wxYES == wxMessageBox(_("Close all pages?"), _("Confim closing all pages"), wxICON_QUESTION|wxYES_NO, this)) { CloseAllPages(true, -1); } return true; } case ID_STN_CLOSE_ALL_OTHERS: { CloseAllPages(true, GetSelection()); return true; } case ID_STN_WIN_PREVIOUS: { if ((GetPageCount() > 0) && (GetSelection() - 1 >= 0)) SetSelection(GetSelection() - 1); else if (GetPageCount() > 0) SetSelection((int)GetPageCount() - 1); return true; } case ID_STN_WIN_NEXT: { if ((GetPageCount() > 0) && (GetSelection() + 1 < (int)GetPageCount())) SetSelection(GetSelection() + 1); else if (GetPageCount() > 0) SetSelection(0); return true; } case ID_STN_WINDOWS: { wxSTEditorWindowsDialog(this, _("Windows")); return true; } case ID_STE_PASTE_NEW: { wxString text; if (wxSTEditor::GetClipboardText(&text)) { NewPage(); wxSTEditor* editor = GetEditor(); if (editor) { editor->SetText(text); editor->SetModified(false); } } return true; } default: { if ((win_id >= ID_STN_GOTO_PAGE_START) && (win_id < ID_STN_GOTO_PAGE_START+n_page)) { SetSelection(win_id - ID_STN_GOTO_PAGE_START); return true; } else if ((win_id >= ID_STN_CLOSE_PAGE_START) && (win_id < ID_STN_CLOSE_PAGE_START+n_page)) { ClosePage(win_id - ID_STN_CLOSE_PAGE_START); return true; } break; } } return false; }
/** * @brief Load arrays with all directories & files in specified dir */ void LoadAndSortFiles(LPCTSTR sDir, DirItemArray * dirs, DirItemArray * files, bool casesensitive) { LoadFiles(sDir, dirs, files); Sort(dirs, casesensitive); Sort(files, casesensitive); }
int main(int argc, char* args[]) { if(SDL_Init(SDL_INIT_EVERYTHING) < 0) { printf("Failed to initialize SDL!\n"); return 0; } Backbuffer = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE); SDL_WM_SetCaption("Green is my pepper", NULL); if(!LoadFiles()) { printf("Failed to load all files!\n"); FreeFiles(); SDL_Quit(); return 0; } while(ProgramIsRunning()) { //Update's the sprites frame FrameCounter++; if(FrameCounter > FrameDelay) { FrameCounter = 0; SpriteFrame++; } if(SpriteFrame > MaxSpriteFrame) SpriteFrame = 0; //Update's Background scrolling //BackgroundX-=6; //if(BackgroundX <= -800) // BackgroundX = 0; //freeX += 3; //if(freeX >= 800) // freeX = 0; // I ought to write a macro for this switch(direction){ case NE: // it's > N and E border if(freeX >= 800-32 && freeY >= 600+32){ direction = SW; } // it's > E border else if (freeX >= 800-32){ direction = NW; } // it's > N border else if (freeY >= 600+32){ direction = SE; } // continue normally else{ freeX+=INC; freeY+=INC; //printf("NE\n"); } break; case NW: // it's greater than N and W border if(freeX <= 0 && freeY >= 600+32){ direction = SE; } // it's > W border else if (freeX <= 0){ direction = NE; } // it's > N border else if (freeY >= 600 + 32){ direction = SW; } // continue normally else{ freeX-=INC; freeY+=INC; //printf("NW\n"); } break; case SE: // it's greater than S and E border if(freeX >= 800-32 && freeY <= 0){ direction = NW; } // it's > E border else if (freeX >= 800-32){ direction = SW; } // it's > S border else if (freeY <= 0+32){ direction = NE; } else{ freeX+=INC; freeY-=INC; //printf("SE\n"); } break; case SW: // it's greater than S and W border if(freeX <= 0 && freeY <= 0){ direction = NE; } // it's > W border else if (freeX <= 0){ direction = SE; } // it's > S border else if (freeY <= 0+32){ direction = NW; } // continue normally else{ freeX-=INC; freeY-=INC; //printf("SW\n"); } break; } //Render the scene DrawImage(Background,Backbuffer, BackgroundX, 0); DrawImage(Background,Backbuffer, BackgroundX+800, 0); DrawImage(SpriteImage, Backbuffer, freeX,600-freeY); SDL_Delay(20); SDL_Flip(Backbuffer); } FreeFiles(); SDL_Quit(); return 0; }
void PlayListItemESEQ::Start() { // load the FSEQ LoadFiles(); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, #ifdef _WIN32_WCE LPWSTR lpCmdLine, #else LPSTR lpCmdLine2, #endif int nCmdShow) #endif { #ifdef WIN32 Args args(GetCommandLine(), "DRIVER FILE"); #else Args args(argc, argv, "DRIVER FILE"); #endif DebugReplay *replay = CreateDebugReplay(args); if (replay == NULL) return EXIT_FAILURE; args.ExpectEnd(); InitialiseDataPath(); Profile::SetFiles(_T("")); Profile::Load(); const Waypoints way_points; InterfaceBlackboard blackboard; blackboard.SetComputerSettings().SetDefaults(); GlideComputerTaskEvents task_events; TaskManager task_manager(way_points); task_manager.SetTaskEvents(task_events); Airspaces airspace_database; AirspaceWarningManager airspace_warning(airspace_database); ProtectedTaskManager protected_task_manager(task_manager, blackboard.GetComputerSettings().task); LoadFiles(airspace_database); GlideComputer glide_computer(way_points, airspace_database, protected_task_manager, task_events); glide_computer.SetTerrain(terrain); glide_computer.Initialise(); glide_computer.ReadComputerSettings(blackboard.GetComputerSettings()); ScreenGlobalInit screen_init; LoadReplay(replay, glide_computer, blackboard); delete replay; #ifdef WIN32 ResourceLoader::Init(hInstance); #endif Layout::Initialize(640, 480); SingleWindow main_window; main_window.set(_T("STATIC"), _T("RunAnalysis"), PixelRect{0, 0, 640, 480}); Fonts::Initialize(); dialog_settings.SetDefaults(); Look *look = new Look(); look->Initialise(); look->InitialiseConfigured(blackboard.GetUISettings()); SetXMLDialogLook(look->dialog); dialog_look = &look->dialog; main_window.show(); dlgAnalysisShowModal(main_window, *look, blackboard, glide_computer, &protected_task_manager, &airspace_database, terrain); delete look; Fonts::Deinitialize(); delete terrain; DeinitialiseDataPath(); return 0; }
DataStorage::Pointer IOUtil::LoadFiles(const std::vector<std::string>& fileNames) { mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New(); LoadFiles(fileNames, *ds); return ds.GetPointer(); }
void Lua::Load() { LoadFiles(); LoadFactories(); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, #ifdef _WIN32_WCE LPWSTR lpCmdLine, #else LPSTR lpCmdLine2, #endif int nCmdShow) #endif { InitialiseDataPath(); Profile::SetFiles(_T("")); Profile::Load(); ComputerSettings settings_computer; settings_computer.SetDefaults(); Profile::Load(settings_computer); MapSettings settings_map; settings_map.SetDefaults(); Profile::Load(settings_map); LoadFiles(settings_computer.poi, settings_computer.team_code); ScreenGlobalInit screen_init; #ifdef WIN32 ResourceLoader::Init(hInstance); #endif MapLook *map_look = new MapLook(); map_look->Initialise(settings_map, Fonts::map, Fonts::map_bold); TrafficLook *traffic_look = new TrafficLook(); traffic_look->Initialise(); TestWindow window(*map_look, *traffic_look); window.Create({640, 480}); GenerateBlackboard(window.map, settings_computer, settings_map); Fonts::Initialize(); #ifdef ENABLE_OPENGL DrawThread::UpdateAll(window.map); #else DrawThread::Draw(window.map); window.initialised = true; #endif window.Show(); window.RunEventLoop(); window.Destroy(); Fonts::Deinitialize(); delete terrain; delete topography; delete traffic_look; delete map_look; DeinitialiseDataPath(); return 0; }
bool ArkanoidRemakeSdl::Init() { LoadConfiguration("config.txt"); mBall.SetDefaultSpeed(360.0); return InitSdl() && LoadFiles() && ArkanoidRemake::Init(); }