int32_t C4SoundSystem::LoadEffects(C4Group &hGroup, const char *namespace_prefix, bool group_is_root) { // Local definition sounds: If there is a Sound.ocg in the group, load the sound from there if(group_is_root && hGroup.FindEntry(C4CFN_Sound)) { C4Group g; g.OpenAsChild(&hGroup, C4CFN_Sound, false, false); return LoadEffects(g, namespace_prefix, false); } int32_t iNum=0; char szFilename[_MAX_FNAME+1]; char szFileType[_MAX_FNAME+1]; C4SoundEffect *nsfx; // Process segmented list of file types for (int32_t i = 0; SCopySegment(C4CFN_SoundFiles, i, szFileType, '|', _MAX_FNAME); i++) { // Search all sound files in group hGroup.ResetSearch(); while (hGroup.FindNextEntry(szFileType, szFilename)) // Create and load effect if ((nsfx = new C4SoundEffect)) { if (nsfx->Load(szFilename, hGroup, namespace_prefix)) { // Overload same name effects RemoveEffect(nsfx->Name); // Add effect nsfx->Next=FirstSound; FirstSound=nsfx; iNum++; } else delete nsfx; } } // Load subgroups from Sound.ocg and other subgroups if (!group_is_root) { hGroup.ResetSearch(); while (hGroup.FindNextEntry(C4CFN_SoundSubgroups, szFilename)) { // Load from subgroup as a sub-namespace // get namespace name StdStrBuf sub_namespace; if (namespace_prefix) { sub_namespace.Copy(namespace_prefix); sub_namespace.Append("::"); } sub_namespace.Append(szFilename, strlen(szFilename) - strlen(C4CFN_SoundSubgroups) + 1); // load from child group C4Group subgroup; if (subgroup.OpenAsChild(&hGroup, szFilename, false, false)) { iNum += LoadEffects(subgroup, sub_namespace.getData(), false); } } } return iNum; }
DiEffectManager::DiEffectManager () : mLastCreatedTemplateName(DiString::BLANK) { InitFactories(); LoadEffects(); }
void CForceFeedBackSystem::LoadXmlData() { const char* xmlDataFile = "Libs/GameForceFeedback/ForceFeedbackEffects.xml"; XmlNodeRef rootNode = gEnv->pSystem->LoadXmlFromFile(xmlDataFile); if (!rootNode || strcmpi(rootNode->getTag(), "ForceFeedback")) { FORCEFEEDBACK_LOG("Could not load force feedback system data. Invalid XML file '%s'! ", xmlDataFile); return; } const int childCount = rootNode->getChildCount(); for (int i = 0; i < childCount; ++i) { XmlNodeRef childNode = rootNode->getChild(i); const char* childTag = childNode->getTag(); if (strcmp(childTag, "Patterns") == 0) { LoadPatters(childNode); } else if (strcmp(childTag, "Envelopes") == 0) { LoadEnvelopes(childNode); } else if (strcmp(childTag, "Effects") == 0) { LoadEffects(childNode); } } }
void CGControlSys::LoadEnvironment(int iStage) { // m_Environment.LoadSkyDome(SFullName("ev_environment", "skydome.smd")); m_Environment.LoadSkyDome(iStage); LoadEffects(); }
bool psEffectManager::LoadFromDirectory(const csString & path, bool includeSubDirs, iView * parentView) { bool success = true; #ifndef DONT_DO_EFFECTS csRef<iVFS> vfs = csQueryRegistry<iVFS> (psCSSetup::object_reg); assert(vfs); if (!vfs->Exists(path)) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Failed to load effects from directory; %s does not exist", path.GetData()); return false; } if (!vfs->ChDir(path)) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Failed to load effects from directory; %s read failed", path.GetData()); return false; } csRefArray<iThreadReturn> threadReturns; csRef<iStringArray> files = vfs->FindFiles("*"); for (size_t a=0; a<files->GetSize(); ++a) { const char * file = files->Get(a); if (file[0] == '.') continue; if (strcmp(file, path) == 0) continue; size_t len = strlen(file); char lastChar = file[len-1]; if (lastChar == '/' || lastChar == '\\') { if (includeSubDirs) { if (!LoadFromDirectory(file, true, parentView)) { success = false; } } } else if (len > 4 && ((lastChar == 'f' || lastChar == 'F') && (file[len-2] == 'f' || file[len-2] == 'F') && (file[len-3] == 'e' || file[len-3] == 'E') && file[len-4] == '.')) { threadReturns.Push(LoadEffects(file, parentView)); } } #endif csRef<iThreadManager> threadman = csQueryRegistry<iThreadManager>(object_reg); return threadman->Wait(threadReturns); }
// XBMC has loaded us into memory, // we should set our core values // here and load any settings we // may have from our config file extern "C" void Create(LPDIRECT3DDEVICE8 pd3dDevice, int iWidth, int iHeight, const char* szScreenSaverName, float ratio) { memset(&world,0,sizeof(WaterSettings)); strcpy(m_szScrName,szScreenSaverName); g_pd3dDevice = pd3dDevice; m_iWidth = iWidth; m_iHeight = iHeight; world.scaleX = 1.0f; if ( (ratio * iWidth / iHeight) > 1.5) world.scaleX = 1/1.333f;//0.91158f/ratio; widescreen mode // Load the settings LoadSettings(); CreateLight(); LoadEffects(); if (world.isTextureMode) { LoadTexture(); world.effectCount--; //get rid of logo effect } world.effectType = rand()%world.effectCount; //world.effectType = 5; world.frame = 0; world.nextEffectTime = 0; /* char buff[100]; for(int j = 0; j < 15; j++) { buff[j] = (int)ratio + '0'; ratio = (ratio - (int)ratio)*10; } buff[15] = 0; ((EffectText*)(effects[6]))->drawString(buff,0.6f,0.6f,1.3f,0.06f,-7.0f,7.8f);*/ //world.widescreen = (float)iWidth/ (float)iHeight > 1.7f; }
bool C4SoundSystem::Init() { if (!Application.MusicSystem.MODInitialized && !Application.MusicSystem.InitializeMOD()) return false; // Might be reinitialisation ClearEffects(); // (re)init EFX Modifiers.Init(); // Open sound file if (!SoundFile.IsOpen()) if (!Reloc.Open(SoundFile, C4CFN_Sound)) return false; // Load static sound from Sound.ocg LoadEffects(SoundFile, NULL, false); #if AUDIO_TK == AUDIO_TK_SDL_MIXER Mix_AllocateChannels(C4MaxSoundInstances); #endif return true; }
void ColladaDoc::Load( lpxmlnode pNode) { lpxmlnode pCurrNode = pNode; std::string Name = pCurrNode->name(); if(Name == "COLLADA") { // COLLADA header found pCurrNode = pCurrNode->first_node(); while(pCurrNode != NULL) { Name = pCurrNode->name(); if(Name == "library_images") LoadImages(pCurrNode->first_node()); else if(Name == "library_effects") LoadEffects(pCurrNode->first_node()); else if(Name == "library_materials") LoadMaterials(pCurrNode->first_node()); else if(Name == "library_geometries") LoadGeometries(pCurrNode->first_node()); else if(Name == "library_animations") LoadAnimations(pCurrNode->first_node()); else if(Name =="library_controllers") LoadControllers(pCurrNode->first_node()); else if(Name == "library_visual_scenes") LoadVisualScenes(pCurrNode->first_node()); else if(Name == "asset") LoadAssets(pCurrNode->first_node()); pCurrNode = pCurrNode->next_sibling(); }; } }
BattleSystem::BattleSystem( ) : _effects( []( std::vector<Effect> effects ) { std::map<int, Effect> temp; for( int i = 0, limit = effects.size( ); i < limit; i++ ) { temp.try_emplace( 1 << i, effects[i] ); } return temp; }( LoadEffects( ) ) ), _spells( []( std::vector<Spell> spells ) { std::map<int, Spell> temp; for( int i = 0, limit = spells.size( ); i < limit; i++ ) { temp.try_emplace( 1 << i, spells[i] ); } return temp; }( LoadSpells( ) ) ) { }
bool psEffectManager::LoadFromEffectsList(const csString & fileName, iView * parentView) { #ifndef DONT_DO_EFFECTS csRef<iVFS> vfs = csQueryRegistry<iVFS> (psCSSetup::object_reg); assert(vfs); if (!vfs->Exists(fileName)) return false; csRef<iDocument> doc; csRef<iDocumentNodeIterator> xmlbinds; csRef<iDocumentSystem> xml; const char* error; csRef<iDataBuffer> buff = vfs->ReadFile(fileName); if (buff == 0) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Could not find file: %s", fileName.GetData()); return false; } xml = csQueryRegistry<iDocumentSystem> (psCSSetup::object_reg); doc = xml->CreateDocument(); assert(doc); error = doc->Parse( buff ); if ( error ) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Parse error in %s: %s", fileName.GetData(), error); return false; } if (doc == 0) return false; csRef<iDocumentNode> root = doc->GetRoot(); if (root == 0) { csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "No root in XML"); return false; } csRefArray<iThreadReturn> threadReturns; csRef<iDocumentNode> listNode = root->GetNode("effectsFileList"); if (listNode != 0) { xmlbinds = listNode->GetNodes("effectsFile"); csRef<iDocumentNode> fileNode; while (xmlbinds->HasNext()) { fileNode = xmlbinds->Next(); csString effectFile = fileNode->GetAttributeValue("file"); if (vfs->Exists(effectFile)) { threadReturns.Push(LoadEffects(effectFile, parentView)); } } } csRef<iThreadManager> threadman = csQueryRegistry<iThreadManager>(object_reg); return threadman->Wait(threadReturns); #endif return true; }
// The `main program' equivalent, creating the windows and returning the // main frame bool AudacityApp::OnInit() { // Unused strings that we want to be translated, even though // we're not using them yet... wxString future1 = _("Master Gain Control"); wxString future2 = _("Input Meter"); wxString future3 = _("Output Meter"); ::wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxZipFSHandler); InitPreferences(); #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__) this->AssociateFileTypes(); #endif // // Paths: set search path and temp dir path // wxString home = wxGetHomeDir(); mAppHomeDir = home; // On Unix systems, the default temp dir is in /tmp. // Search path (in this order): // * The AUDACITY_PATH environment variable // * The current directory // * The user's .audacity-files directory in their home directory // * The "share" and "share/doc" directories in their install path #ifdef __WXGTK__ defaultTempDir.Printf(wxT("/tmp/audacity1.2-%s"), wxGetUserId().c_str()); wxString pathVar = wxGetenv(wxT("AUDACITY_PATH")); if (pathVar != wxT("")) AddMultiPathsToPathList(pathVar, audacityPathList); AddUniquePathToPathList(FROMFILENAME(::wxGetCwd()), audacityPathList); AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"), home.c_str()), audacityPathList); #ifdef AUDACITY_NAME AddUniquePathToPathList(wxString::Format(wxT("%s/share/%s"), wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)), audacityPathList); AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/%s"), wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)), audacityPathList); #else AddUniquePathToPathList(wxString::Format(wxT("%s/share/audacity"), wxT(INSTALL_PREFIX)), audacityPathList); AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/audacity"), wxT(INSTALL_PREFIX)), audacityPathList); #endif AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"), wxT(INSTALL_PREFIX)), audacityPathList); #endif wxFileName tmpFile; tmpFile.AssignTempFileName(wxT("nn")); wxString tmpDirLoc = tmpFile.GetPath(wxPATH_GET_VOLUME); ::wxRemoveFile(FILENAME(tmpFile.GetFullPath())); // On Mac and Windows systems, use the directory which contains Audacity. #ifdef __WXMSW__ // On Windows, the path to the Audacity program is in argv[0] wxString progPath = wxPathOnly(argv[0]); AddUniquePathToPathList(progPath, audacityPathList); AddUniquePathToPathList(progPath+wxT("\\Languages"), audacityPathList); defaultTempDir.Printf(wxT("%s\\audacity_1_2_temp"), tmpDirLoc.c_str()); #endif #ifdef __MACOSX__ // On Mac OS X, the path to the Audacity program is in argv[0] wxString progPath = wxPathOnly(argv[0]); AddUniquePathToPathList(progPath, audacityPathList); // If Audacity is a "bundle" package, then the root directory is // the great-great-grandparent of the directory containing the executable. AddUniquePathToPathList(progPath+wxT("/../../../"), audacityPathList); AddUniquePathToPathList(progPath+wxT("/Languages"), audacityPathList); AddUniquePathToPathList(progPath+wxT("/../../../Languages"), audacityPathList); defaultTempDir.Printf(wxT("%s/audacity1.2-%s"), tmpDirLoc.c_str(), wxGetUserId().c_str()); #endif #ifdef __MACOS9__ // On Mac OS 9, the initial working directory is the one that // contains the program. wxString progPath = wxGetCwd(); AddUniquePathToPathList(progPath, audacityPathList); AddUniquePathToPathList(progPath+wxT(":Languages"), audacityPathList); defaultTempDir.Printf(wxT("%s/audacity_1_2_temp"), tmpDirLoc.c_str()); #endif // BG: Create a temporary window to set as the top window wxFrame *temporarywindow = new wxFrame(NULL, -1, wxT("temporarytopwindow")); SetTopWindow(temporarywindow); // Locale // wxWindows 2.3 has a much nicer wxLocale API. We can make this code much // better once we move to wx 2.3/2.4. wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT("")); // Pop up a dialog the first time the program is run if (lang == wxT("")) lang = ChooseLanguage(NULL); #ifdef NOT_RQD //TIDY-ME: (CleanSpeech) Language prompt?? // The prompt for language only happens ONCE on a system. // I don't think we should disable it JKC wxString lang = gPrefs->Read(wxT("/Locale/Language"), "en"); //lda // Pop up a dialog the first time the program is run //lda if (lang == "") //lda lang = ChooseLanguage(NULL); #endif gPrefs->Write(wxT("/Locale/Language"), lang); if (lang != wxT("en")) { wxLogNull nolog; mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true); for(unsigned int i=0; i<audacityPathList.GetCount(); i++) mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]); #ifdef AUDACITY_NAME mLocale->AddCatalog(wxT(AUDACITY_NAME)); #else mLocale->AddCatalog(wxT("audacity")); #endif } else mLocale = NULL; // Initialize internationalisation (number formats etc.) // // This must go _after_ creating the wxLocale instance because // creating the wxLocale instance sets the application-wide locale. Internat::Init(); // Init DirManager, which initializes the temp directory // If this fails, we must exit the program. if (!InitTempDir()) { FinishPreferences(); return false; } // More initialization InitCleanSpeech(); InitDitherers(); InitAudioIO(); LoadEffects(); #ifdef __WXMAC__ // On the Mac, users don't expect a program to quit when you close the last window. // Create an offscreen frame with a menu bar. The frame should never // be visible, but when all other windows are closed, this menu bar should // become visible. gParentFrame = new wxFrame(NULL, -1, wxT("invisible"), wxPoint(5000, 5000), wxSize(100, 100)); wxMenu *fileMenu = new wxMenu(); fileMenu->Append(wxID_NEW, wxT("&New\tCtrl+N")); fileMenu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O")); /* i18n-hint: Mac OS X shortcut should be Ctrl+, */ fileMenu->Append(wxID_PREFERENCES, _("&Preferences...\tCtrl+,")); wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, wxT("&File")); gParentFrame->SetMenuBar(menuBar); gParentFrame->Show(); SetTopWindow(gParentFrame); #endif SetExitOnFrameDelete(true); /////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// //Initiate pointers to toolbars here, and create //the toolbars that should be loaded at startup. gControlToolBarStub = LoadToolBar( wxT(""),true, gParentWindow,ControlToolBarID); gMixerToolBarStub = LoadToolBar( wxT("/GUI/EnableMixerToolBar"),true, gParentWindow,MixerToolBarID); gMeterToolBarStub = LoadToolBar( wxT("/GUI/EnableMeterToolBar"),true, gParentWindow,MeterToolBarID); gEditToolBarStub = LoadToolBar( wxT("/GUI/EnableEditToolBar"),true, gParentWindow,EditToolBarID); gTranscriptionToolBarStub = LoadToolBar( wxT("/GUI/EnableTranscriptionToolBar"),false, gParentWindow,TranscriptionToolBarID); /// ToolBar Initiation Complete. //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// AudacityProject *project = CreateNewAudacityProject(gParentWindow); SetTopWindow(project); delete temporarywindow; // Can't handle command-line args on Mac OS X yet... // Cygwin command-line parser below... #if !defined(__MACOSX__) && !defined(__CYGWIN__) // Parse command-line arguments if (argc > 1) { for (int option = 1; option < argc; option++) { if (!argv[option]) continue; bool handled = false; if (!wxString(wxT("-help")).CmpNoCase(argv[option])) { wxPrintf(/* i18n-hint: '-help', '-test' and '-blocksize' need to stay in English. */ _("Command-line options supported:\n -help (this message)\n -test (run self diagnostics)\n -blocksize ### (set max disk block size in bytes)\n\nIn addition, specify the name of an audio file or Audacity project\nto open it.\n\n")); exit(0); } if (option < argc - 1 && argv[option + 1] && !wxString(wxT("-blocksize")).CmpNoCase(argv[option])) { long theBlockSize; if (wxString(argv[option + 1]).ToLong(&theBlockSize)) { if (theBlockSize >= 256 && theBlockSize < 100000000) { wxFprintf(stderr, _("Using block size of %ld\n"), theBlockSize); Sequence::SetMaxDiskBlockSize(theBlockSize); } } option++; handled = true; } if (!handled && !wxString(wxT("-test")).CmpNoCase(argv[option])) { RunBenchmark(NULL); exit(0); } if (argv[option][0] == wxT('-') && !handled) { wxPrintf(_("Unknown command line option: %s\n"), argv[option]); exit(0); } if (!handled) project->OpenFile(argv[option]); } // for option... } // if (argc>1) #endif // not Mac OS X // Cygwin command line parser (by Dave Fancella) #if defined(__CYGWIN__) if (argc > 1) { int optionstart = 1; bool startAtOffset = false; // Scan command line arguments looking for trouble for (int option = 1; option < argc; option++) { if (!argv[option]) continue; // Check to see if argv[0] is copied across other arguments. // This is the reason Cygwin gets its own command line parser. if (wxString(argv[option]).Lower().Contains(wxString(wxT("audacity.exe")))) { startAtOffset = true; optionstart = option + 1; } } for (int option = optionstart; option < argc; option++) { if (!argv[option]) continue; bool handled = false; bool openThisFile = false; wxString fileToOpen; if (!wxString(wxT("-help")).CmpNoCase(argv[option])) { wxPrintf(/* i18n-hint: '-help', '-test' and '-blocksize' need to stay in English. */ _("Command-line options supported:\n" " -help (this message)\n" " -test (run self diagnostics)\n" " -blocksize ### (set max disk block size in bytes)\n" "\n" "In addition, specify the name of an audio file or " "Audacity project\n" "to open it.\n" "\n")); exit(0); } if (option < argc - 1 && argv[option + 1] && !wxString(wxT("-blocksize")).CmpNoCase(argv[option])) { long theBlockSize; if (wxString(argv[option + 1]).ToLong(&theBlockSize)) { if (theBlockSize >= 256 && theBlockSize < 100000000) { wxFprintf(stderr, _("Using block size of %ld\n"), theBlockSize); Sequence::SetMaxDiskBlockSize(theBlockSize); } } option++; handled = true; } if (!handled && !wxString(wxT("-test")).CmpNoCase(argv[option])) { RunBenchmark(NULL); exit(0); } if (argv[option][0] == wxT('-') && !handled) { wxPrintf(_("Unknown command line option: %s\n"), argv[option]); exit(0); } if(handled) fileToOpen.Clear(); if (!handled) fileToOpen = fileToOpen + wxT(" ") + argv[option]; if(wxString(argv[option]).Lower().Contains(wxT(".aup"))) openThisFile = true; if(openThisFile) { openThisFile = false; project->OpenFile(fileToOpen); } } // for option... } // if (argc>1) #endif // Cygwin command-line parser gInited = true; return TRUE; }
//Función para cargar los recursos necesarios para el juego. bool cGame::LoadResources( void ) { bool lbResult; lbResult = LoadWindowProperties(); if ( lbResult ) { //Se inicializa la clase que encapsula las operaciones de OpenGL: lbResult = cGraphicManager::Get().Init( &cWindow::Get() ); // Clean Window context glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Resetea color de fondo glClearColor(0.0f, 0.0f, 0.0f, 1.0f); if (lbResult) { //Se inicializa la clase que gestiona la texturas indicando que habrá 1, por ejemplo. cTextureManager::Get().Init(60); mMad_drive_loading = cTextureManager::Get().LoadResource( "Mad_drive_loading", "Data/Scene/images/hud/mad_drive_loading.png" ); mMad_drive = cTextureManager::Get().LoadResource( "Mad_drive", "Data/Scene/images/hud/mad_drive.png" ); mLoading = cTextureManager::Get().LoadResource( "Loading", "Data/Scene/images/hud/loading.png" ); Load2DCameraProperties(); cGraphicManager::Get().ActivateCamera( &m2DCamera ); RenderProgress(0.1f); Load3DCameraProperties(); RenderProgress(0.2f); LoadIAProperties(); LoadManagerProperties(); RenderProgress(0.3f); //Se carga la escena. //mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/dragonsmall.DAE" ); //*mDuck = cSceneManager::Get().LoadResource( "Duck", "./Data/Scene/duck_triangulate.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_cactus.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_carretera.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_matorral.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_palmera.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_tronco.dae" ); LoadVehicles(); RenderProgress(0.5f); LoadHUD(); RenderProgress(0.6f); LoadEffects(); RenderProgress(0.7f); LoadObstacles(); RenderProgress(0.85f); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_exterior.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_arma.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_rueda.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mad_drive_escombros_ruina.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/combustible.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/especial_invencibilidad.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/especial_superturbo.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/municion.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo1_destruido_arma.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo1_destruido_exterior.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_destruido_arma.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/enemigo2_destruido_exterior.dae" ); // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/mustang_destruido_exterior.dae" ); //mScene1 = cSceneManager::Get().LoadResource( "TestLevel1", "./Data/Scene/mustang_destruido_interior.dae" ); // Loads skeleton // cResourceHandle mustang_mesh = cMeshManager::Get().LoadResource("testlevel1", "./Data/Scene/mustang_destruido_interior.dae"); /*if (!((cScene *)mScene.GetResource())->Init("TestLevel1", "./Data/Scene/mustang_destruido_interior.dae")){ OutputDebugStr("Error loading object!"); }*/ // mScene = cSceneManager::Get().LoadResource( "TestLevel", "./Data/Scene/plane.DAE" ); //cPhysicObject mModelObject = *((cPhysicObject*) ((cScene *)mScene.GetResource())->getSubObject( 1 )); // Inits skeleton model //cSkeletalManager::Get().LoadResource("Skeleton", "./Data/Skeletal/SkeletonModel.xml"); // Loads skeleton //mSkeletalMesh = cMeshManager::Get().LoadResource("Skeleton", "Skeleton", kuiSkeletalMesh); // Get skeleton mesh //cSkeletalMesh* lpSkeletonMesh=(cSkeletalMesh*)mSkeletalMesh.GetResource(); // Load Skeleton meshes //cResourceHandle lMaterial = cMaterialManager::Get().LoadResource("Skeleton", "./Data/Material/SkeletonMaterial.xml"); //assert(lMaterial.IsValidHandle()); //mObject.AddMesh(mSkeletalMesh, lMaterial); // Bounding box del personaje /*mBoxModel.InitBox( 0.0f, cVec3( 0.3f, 1.0f, 0.3f ) ); mObject.CreatePhysics( &mBoxModel ); lScaleMatrix.LoadScale(0.01f); mObject.SetScaleMatrix( lScaleMatrix );*/ LoadObjects(); RenderProgress(1.0f); LoadWorld(); } else { //Si algo falla se libera la ventana. cWindow::Get().Deinit(); } } return lbResult; }
bool SequenceElements::LoadSequencerFile(xLightsXmlFile& xml_file) { mFilename = xml_file; wxXmlDocument& seqDocument = xml_file.GetXmlDocument(); wxXmlNode* root=seqDocument.GetRoot(); std::vector<std::string> effectStrings; std::vector<std::string> colorPalettes; Clear(); for(wxXmlNode* e=root->GetChildren(); e!=NULL; e=e->GetNext() ) { if (e->GetName() == "DisplayElements") { for(wxXmlNode* element=e->GetChildren(); element!=NULL; element=element->GetNext() ) { bool active=false; bool selected=false; bool collapsed=false; std::string name = element->GetAttribute(STR_NAME).ToStdString(); std::string type = element->GetAttribute(STR_TYPE).ToStdString(); bool visible = element->GetAttribute("visible")=='1'?true:false; if (type==STR_TIMING) { active = element->GetAttribute("active")=='1'?true:false; } else { collapsed = element->GetAttribute("collapsed")=='1'?true:false; } Element* elem = AddElement(name,type,visible,collapsed,active,selected); if (type==STR_TIMING) { std::string views = element->GetAttribute("views", "").ToStdString(); elem->SetViews(views); } } } else if (e->GetName() == "EffectDB") { effectStrings.clear(); for(wxXmlNode* elementNode=e->GetChildren(); elementNode!=NULL; elementNode=elementNode->GetNext() ) { if(elementNode->GetName()==STR_EFFECT) { effectStrings.push_back(elementNode->GetNodeContent().ToStdString()); } } } else if (e->GetName() == "ColorPalettes") { colorPalettes.clear(); for(wxXmlNode* elementNode=e->GetChildren(); elementNode!=NULL; elementNode=elementNode->GetNext() ) { if(elementNode->GetName() == STR_COLORPALETTE) { colorPalettes.push_back(elementNode->GetNodeContent().ToStdString()); } } } else if (e->GetName() == "ElementEffects") { for(wxXmlNode* elementNode=e->GetChildren(); elementNode!=NULL; elementNode=elementNode->GetNext() ) { if(elementNode->GetName()==STR_ELEMENT) { Element* element = GetElement(elementNode->GetAttribute(STR_NAME).ToStdString()); if (element !=NULL) { // check for fixed timing interval int interval = 0; if( elementNode->GetAttribute(STR_TYPE) == STR_TIMING ) { interval = wxAtoi(elementNode->GetAttribute("fixed")); } if( interval > 0 ) { element->SetFixedTiming(interval); EffectLayer* effectLayer = element->AddEffectLayer(); int time = 0; int end_time = xml_file.GetSequenceDurationMS(); int startTime, endTime, next_time; while( time <= end_time ) { next_time = (time + interval <= end_time) ? time + interval : end_time; startTime = TimeLine::RoundToMultipleOfPeriod(time,mFrequency); endTime = TimeLine::RoundToMultipleOfPeriod(next_time,mFrequency); effectLayer->AddEffect(0,"","","",startTime,endTime,EFFECT_NOT_SELECTED,false); time += interval; } } else { for(wxXmlNode* effectLayerNode=elementNode->GetChildren(); effectLayerNode!=NULL; effectLayerNode=effectLayerNode->GetNext()) { if (effectLayerNode->GetName() == STR_EFFECTLAYER || effectLayerNode->GetName() == STR_STRAND) { EffectLayer* effectLayer = NULL; if (effectLayerNode->GetName() == STR_EFFECTLAYER) { effectLayer = element->AddEffectLayer(); } else { effectLayer = element->GetStrandLayer(wxAtoi(effectLayerNode->GetAttribute(STR_INDEX)), true); if (effectLayerNode->GetAttribute(STR_NAME, STR_EMPTY) != STR_EMPTY) { ((StrandLayer*)effectLayer)->SetName(effectLayerNode->GetAttribute(STR_NAME).ToStdString()); } } LoadEffects(effectLayer, elementNode->GetAttribute(STR_TYPE).ToStdString(), effectLayerNode, effectStrings, colorPalettes); } } } } } } } } // Select view and set current view models as visible int last_view = xml_file.GetLastView(); for(wxXmlNode* view=mViewsNode->GetChildren(); view!=NULL; view=view->GetNext() ) { std::string viewName = view->GetAttribute(STR_NAME).ToStdString(); std::string models = view->GetAttribute("models").ToStdString(); std::vector <Element*> new_view; mAllViews.push_back(new_view); int view_index = mAllViews.size()-1; if( view_index == last_view ) { AddMissingModelsToSequence(models); PopulateView(models, view_index); SetCurrentView(view_index); } } if (mModelsNode != nullptr) { PopulateRowInformation(); } // Set to the first model/view mFirstVisibleModelRow = 0; return true; }
void SequenceElements::LoadEffects(EffectLayer *effectLayer, const std::string &type, wxXmlNode *effectLayerNode, const std::vector<std::string> & effectStrings, const std::vector<std::string> & colorPalettes) { for(wxXmlNode* effect=effectLayerNode->GetChildren(); effect!=NULL; effect=effect->GetNext()) { if (effect->GetName() == STR_EFFECT) { std::string effectName; std::string settings; int id = 0; long palette = -1; bool bProtected=false; // Start time double startTime; effect->GetAttribute(STR_STARTTIME).ToDouble(&startTime); startTime = TimeLine::RoundToMultipleOfPeriod(startTime,mFrequency); // End time double endTime; effect->GetAttribute(STR_ENDTIME).ToDouble(&endTime); endTime = TimeLine::RoundToMultipleOfPeriod(endTime,mFrequency); // Protected bProtected = effect->GetAttribute(STR_PROTECTED)=='1'?true:false; if(type != STR_TIMING) { // Name effectName = effect->GetAttribute(STR_NAME); // ID id = wxAtoi(effect->GetAttribute(STR_ID, STR_ZERO)); if (effect->GetAttribute(STR_REF) != STR_EMPTY) { settings = effectStrings[wxAtoi(effect->GetAttribute(STR_REF))]; } else { settings = effect->GetNodeContent(); } wxString tmp; if (effect->GetAttribute(STR_PALETTE, &tmp)) { tmp.ToLong(&palette); } } else { // store timing labels in name attribute effectName = effect->GetAttribute(STR_LABEL); } effectLayer->AddEffect(id,effectName,settings, palette == -1 ? STR_EMPTY : colorPalettes[palette], startTime,endTime,EFFECT_NOT_SELECTED,bProtected); } else if (effect->GetName() == STR_NODE && effectLayerNode->GetName() == STR_STRAND) { EffectLayer* neffectLayer = ((StrandLayer*)effectLayer)->GetNodeLayer(wxAtoi(effect->GetAttribute(STR_INDEX)), true); if (effect->GetAttribute(STR_NAME, STR_EMPTY) != STR_EMPTY) { ((NodeLayer*)neffectLayer)->SetName(effect->GetAttribute(STR_NAME).ToStdString()); } LoadEffects(neffectLayer, type, effect, effectStrings, colorPalettes); } } }
// The `main program' equivalent, creating the windows and returning the // main frame bool AudacityApp::OnInit() { // mChecker = new wxSingleInstanceChecker(GetAppName()); ::wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxZipFSHandler); #ifdef __WXMSW__ //BG: On Windows, associate the aup file type with Audacity { wxRegKey associateFileTypes; associateFileTypes.SetName("HKCR\\.AUP"); associateFileTypes.Create(true); associateFileTypes = "Audacity.Project"; associateFileTypes.SetName("HKCR\\Audacity.Project"); associateFileTypes.Create(true); associateFileTypes = "Audacity Project File"; associateFileTypes.SetName("HKCR\\Audacity.Project\\shell"); associateFileTypes.Create(true); associateFileTypes = ""; associateFileTypes.SetName("HKCR\\Audacity.Project\\shell\\open"); associateFileTypes.Create(true); associateFileTypes.SetName("HKCR\\Audacity.Project\\shell\\open\\command"); associateFileTypes.Create(true); associateFileTypes = (wxString)argv[0] + (wxString)" %1"; } #endif InitPreferences(); InitAudioIO(); // Locale // wxWindows 2.3 has a much nicer wxLocale API. We can make this code much // better once we move to wx 2.3/2.4. wxString lang = gPrefs->Read("/Locale/Language", "en"); if (lang != "en") { wxLogNull nolog; mLocale = new wxLocale("", lang, "", true, true); mLocale->AddCatalog("audacity"); } else mLocale = NULL; LoadEffects(wxPathOnly(argv[0])); #ifdef __WXMAC__ // Install AppleEvent handlers (allows us to open documents // that are dragged to our application's icon) AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(AEOpenFiles), 0, 0); AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(AEQuit), 0, 0); // On the Mac, users don't expect a program to quit when you close the last window. // Create an offscreen frame with a menu bar. The frame should never // be visible, but when all other windows are closed, this menu bar should // become visible. gParentFrame = new wxFrame(NULL, -1, "invisible", wxPoint(5000, 5000), wxSize(100, 100)); wxMenu *fileMenu = new wxMenu(); fileMenu->Append(NewID, "&New\tCtrl+N"); fileMenu->Append(OpenID, "&Open...\tCtrl+O"); fileMenu->AppendSeparator(); fileMenu->Append(PreferencesID, "&Preferences...\tCtrl+P"); fileMenu->AppendSeparator(); fileMenu->Append(ExitID, "Quit\tCtrl+Q"); wxMenu *helpMenu = new wxMenu(); helpMenu->Append(AboutID, "About Audacity..."); wxApp::s_macAboutMenuItemId = AboutID; wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, "&File"); menuBar->Append(helpMenu, "&Help"); gParentFrame->SetMenuBar(menuBar); gParentFrame->Show(); SetTopWindow(gParentFrame); #endif SetExitOnFrameDelete(true); //Initiate pointers to toolbars here, and create //the toolbars that should be loaded at startup. //Initiate globally-held toolbar stubs here. gControlToolBarStub = new ToolBarStub(gParentWindow, ControlToolBarID); // Changing the following to NULL will make the application // load without the toolbar in memory at all. bool editToolBar; gPrefs->Read("/GUI/EnableEditToolBar", &editToolBar, true); if(editToolBar) gEditToolBarStub = new ToolBarStub(gParentWindow, EditToolBarID); else gEditToolBarStub = NULL; InitFreqWindow(gParentWindow); AudacityProject *project = CreateNewAudacityProject(gParentWindow); SetTopWindow(project); // Can't handle command-line args on Mac OS X yet... #ifndef __MACOSX__ // Parse command-line arguments if (argc > 1) { for (int option = 1; option < argc; option++) { if (!argv[option]) continue; bool handled = false; if (!wxString("-help").CmpNoCase(argv[option])) { printf(_("Command-line options supported:\n" " -help (this message)\n" " -test (run self diagnostics)\n" " -blocksize ### (set max disk block size in bytes)\n" "\n" "In addition, specify the name of an audio file or " "Audacity project\n" "to open it.\n" "\n")); exit(0); } if (option < argc - 1 && argv[option + 1] && !wxString("-blocksize").CmpNoCase(argv[option])) { long theBlockSize; if (wxString(argv[option + 1]).ToLong(&theBlockSize)) { if (theBlockSize >= 256 && theBlockSize < 100000000) { fprintf(stderr, _("Using block size of %ld\n"), theBlockSize); Sequence::SetMaxDiskBlockSize(theBlockSize); } } option++; handled = true; } if (!handled && !wxString("-test").CmpNoCase(argv[option])) { RunBenchmark(NULL); exit(0); } if (argv[option][0] == '-' && !handled) { printf(_("Unknown command line option: %s\n"), argv[option]); exit(0); } if (!handled) project->OpenFile(argv[option]); } // for option... } // if (argc>1) #endif // not Mac OS X return TRUE; }
void SequenceElements::LoadEffects(EffectLayer *effectLayer, const std::string &type, wxXmlNode *effectLayerNode, const std::vector<std::string> & effectStrings, const std::vector<std::string> & colorPalettes) { log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base")); for(wxXmlNode* effect=effectLayerNode->GetChildren(); effect!=NULL; effect=effect->GetNext()) { if (effect->GetName() == STR_EFFECT) { std::string effectName; std::string settings; int id = 0; long palette = -1; bool bProtected=false; // Start time double startTime; effect->GetAttribute(STR_STARTTIME).ToDouble(&startTime); startTime = TimeLine::RoundToMultipleOfPeriod(startTime,mFrequency); // End time double endTime; effect->GetAttribute(STR_ENDTIME).ToDouble(&endTime); endTime = TimeLine::RoundToMultipleOfPeriod(endTime,mFrequency); // Protected bProtected = effect->GetAttribute(STR_PROTECTED)=='1'?true:false; if(type != STR_TIMING) { // Name effectName = effect->GetAttribute(STR_NAME); // ID id = wxAtoi(effect->GetAttribute(STR_ID, STR_ZERO)); if (effect->GetAttribute(STR_REF) != STR_EMPTY) { int ref = wxAtoi(effect->GetAttribute(STR_REF)); if (ref >= effectStrings.size()) { logger_base.warn("Effect string not found for effect %s between %d and %d. Settings ignored.", effectName.c_str(), (int)startTime, (int)endTime); settings = ""; } else { settings = effectStrings[ref]; } } else { settings = effect->GetNodeContent(); } if (settings.find("E_FILEPICKER_Pictures_Filename") != std::string::npos) { settings = xLightsXmlFile::FixEffectFileParameter("E_FILEPICKER_Pictures_Filename", settings, ""); } else if (settings.find("E_TEXTCTRL_Glediator_Filename") != std::string::npos) { settings = xLightsXmlFile::FixEffectFileParameter("E_TEXTCTRL_Glediator_Filename", settings, ""); } else if (settings.find("E_TEXTCTRL_Piano_CueFilename") != std::string::npos) { settings = xLightsXmlFile::FixEffectFileParameter("E_TEXTCTRL_Piano_CueFilename", settings, ""); } else if (settings.find("E_TEXTCTRL_Piano_MapFilename") != std::string::npos) { settings = xLightsXmlFile::FixEffectFileParameter("E_TEXTCTRL_Piano_MapFilename", settings, ""); } else if (settings.find("E_TEXTCTRL_Piano_ShapeFilename") != std::string::npos) { settings = xLightsXmlFile::FixEffectFileParameter("E_TEXTCTRL_Piano_ShapeFilename", settings, ""); } wxString tmp; if (effect->GetAttribute(STR_PALETTE, &tmp)) { tmp.ToLong(&palette); } } else { // store timing labels in name attribute effectName = effect->GetAttribute(STR_LABEL); } effectLayer->AddEffect(id,effectName,settings, palette == -1 ? STR_EMPTY : colorPalettes[palette], startTime,endTime,EFFECT_NOT_SELECTED,bProtected); } else if (effect->GetName() == STR_NODE && effectLayerNode->GetName() == STR_STRAND) { EffectLayer* neffectLayer = ((StrandLayer*)effectLayer)->GetNodeLayer(wxAtoi(effect->GetAttribute(STR_INDEX)), true); if (effect->GetAttribute(STR_NAME, STR_EMPTY) != STR_EMPTY) { ((NodeLayer*)neffectLayer)->SetName(effect->GetAttribute(STR_NAME).ToStdString()); } LoadEffects(neffectLayer, type, effect, effectStrings, colorPalettes); } } }