CDrawQuadRendererCommand::CDrawQuadRendererCommand(CXMLTreeNode &atts) : CStagedTexturedRendererCommand(atts) { int l_count_textures = atts.GetNumChildren(); for (int i=0; i<l_count_textures; ++i) { int l_StageId = atts(i).GetIntProperty("stage_id", 0); std::string l_File = atts(i).GetPszProperty("file",""); CTexture* l_Texture = CORE->GetTextureManager()->GetTexture(l_File); if (l_Texture != NULL) { CStagedTexturedRendererCommand::AddStageTexture(l_StageId, l_Texture); } } bool l_TextureWidhtAsFrameBuffer = atts.GetBoolProperty("texture_width_as_frame_buffer", true); uint32 w,h; if (l_TextureWidhtAsFrameBuffer) { CORE->GetRenderManager()->GetWidthAndHeight(w, h); } else { w = atts.GetIntProperty("width", 0); h = atts.GetIntProperty("height", 0); } m_Rect.top=m_Rect.left=(long)0.0; m_Rect.right=w-1; m_Rect.bottom=h-1; }
CScissorRectSceneRendererCommand::CScissorRectSceneRendererCommand(CXMLTreeNode &atts) : CSceneRendererCommand(atts) { m_Rect.left = atts.GetIntProperty("left",0); m_Rect.top = atts.GetIntProperty("top",0); m_Rect.right = atts.GetIntProperty("right",0); m_Rect.bottom = atts.GetIntProperty("bottom",0); }
// -------------------------------------------- // CONSTRUCTOR/DESTRUCTOR // -------------------------------------------- CLensFlareSceneRemdererCommand::CLensFlareSceneRemdererCommand( CXMLTreeNode &_Node ) : CSceneRendererCommand ( _Node ) { m_LightIndex = _Node.GetIntProperty("light_index", 0, true); Vect3f glowColor = _Node.GetVect3fProperty("glow_color", v3fZERO, true); m_LensFlare = new CLensFlarePostProcess(); m_LensFlare->SetGlowColor(CColor(Vect4f(glowColor / 255.0f, 1.0f))); m_LensFlare->Init(); }
void CGUIWindow::LoadEditableTextBox (CEditableTextBox** editableTextBox_aux, CXMLTreeNode& pNewNode, const Vect2i& screenResolution, CTextureManager* tm) { //<EditableTextBox name="debug_fps" posx="0" posy="2" height="10" width="10" visible="true" active="true" // texture_quad="blabla" id_font="0" color_font_r="0" color_font_g="0" color_font_b="0" // buffer="" OnSaveValue="blabla" OnLoadValue="blabla" Literal="blabla" widthOffset="" heightOffset="" // Literal="blabla" widthOffset="" heightOffset=""/> CEditableTextBox* editableTextBox; std::string name = pNewNode.GetPszProperty("name", "defaultGuiElement"); float posx = pNewNode.GetFloatProperty("posx", 0.f); float posy = pNewNode.GetFloatProperty("posy", 0.f); float w = pNewNode.GetFloatProperty("width", 50.f); float h = pNewNode.GetFloatProperty("height", 50.f); bool visible = pNewNode.GetBoolProperty("visible", true); bool activated = pNewNode.GetBoolProperty("active", true); std::string quad = pNewNode.GetPszProperty("texture_quad", ""); std::string OnSaveValue = pNewNode.GetPszProperty("OnSaveValue", ""); std::string OnLoadValue = pNewNode.GetPszProperty("OnLoadValue", ""); uint32 idFont = pNewNode.GetIntProperty("id_font", 0); float color_font_r = pNewNode.GetFloatProperty("color_font_r", 0.f); float color_font_g = pNewNode.GetFloatProperty("color_font_g", 0.f); float color_font_b = pNewNode.GetFloatProperty("color_font_b", 0.f); std::string buffer = pNewNode.GetPszProperty("buffer", ""); std::string l_literal = pNewNode.GetPszProperty("Literal", ""); float widthOffsetPercent = pNewNode.GetFloatProperty("widthOffset", 0.f); float heightOffsetPercent = pNewNode.GetFloatProperty("heightOffset", 0.f); uint32 widthOffset = (uint32) (screenResolution.x * 0.01f * widthOffsetPercent ); uint32 heightOffset = (uint32) (screenResolution.y * 0.01f * heightOffsetPercent ); CTexture* quad_texture = tm->GetTexture(quad); editableTextBox = new CEditableTextBox( screenResolution.y,screenResolution.x,h, w, Vect2f(posx,posy), CColor(color_font_r,color_font_g,color_font_b),idFont, l_literal, heightOffset, widthOffset, visible, activated); editableTextBox->SetName(name); editableTextBox->SetBackGroundTexture(quad_texture); editableTextBox->SetBuffer(buffer); editableTextBox->SetOnLoadValueAction(OnSaveValue); editableTextBox->SetOnSaveValueAction(OnLoadValue); *editableTextBox_aux = editableTextBox; }
bool CEffect::Init(const CXMLTreeNode& _xmlEffect, LPD3DXEFFECTPOOL _pEffectPool) { SetOk(true); string l_szName = _xmlEffect.GetPszISOProperty("name",""); if(l_szName.compare("") == 0) { LOGGER->AddNewLog(ELL_ERROR,"CEffect::Init Empty name"); SetOk(false); return false; } SetName(l_szName); m_iTextureMask = _xmlEffect.GetIntProperty("texture_mask",0,false); m_szFileName = _xmlEffect.GetPszISOProperty("file",""); if(m_szFileName.compare("") == 0) { LOGGER->AddNewLog(ELL_ERROR,"CEffect::Init Empty effect path"); SetOk(false); return false; } m_szTechniqueName = _xmlEffect.GetPszISOProperty("technique",""); if(m_szTechniqueName.compare("") == 0) { LOGGER->AddNewLog(ELL_ERROR,"CEffect::Init Empty technique name"); SetOk(false); return false; } m_szInstancedTechniqueName = _xmlEffect.GetPszISOProperty("instanced_technique","", false); m_szD3DAlphaTechniqueName = _xmlEffect.GetPszISOProperty("alpha_technique","", false); SetOk(LoadEffect(_pEffectPool)); return IsOk(); }
void CGUIWindow::LoadProgressBar(CProgressBar** progressBar_aux, CXMLTreeNode& pNewNode, const Vect2i& screenResolution, CTextureManager* tm) { //<ProgressBar name="progressBar1" posx="200" posy="600" height="10" width="100" visible="true" active="true" // texture_back="hola" texture_bar="hola2" id_font="0" color_font_r="0" color_font_g="0" color_font_b="0" // Literal="blabla" widthOffset="" heightOffset="" OnComplete="blabla"/> CProgressBar* progressBar; std::string name = pNewNode.GetPszProperty("name", "defaultGuiElement"); float posx = pNewNode.GetFloatProperty("posx", 0.f); float posy = pNewNode.GetFloatProperty("posy", 0.f); float w = pNewNode.GetFloatProperty("width", 50.f); float h = pNewNode.GetFloatProperty("height", 50.f); bool visible = pNewNode.GetBoolProperty("visible", true); bool activated = pNewNode.GetBoolProperty("active", true); std::string texture_bar = pNewNode.GetPszProperty("texture_bar", ""); std::string texture_back = pNewNode.GetPszProperty("texture_back", ""); std::string OnComplete = pNewNode.GetPszProperty("OnComplete", ""); uint32 idFont = pNewNode.GetIntProperty("id_font", 0); float color_font_r = pNewNode.GetFloatProperty("color_font_r", 0.f); float color_font_g = pNewNode.GetFloatProperty("color_font_g", 0.f); float color_font_b = pNewNode.GetFloatProperty("color_font_b", 0.f); std::string l_literal = pNewNode.GetPszProperty("Literal", ""); float widthOffsetPercent = pNewNode.GetFloatProperty("widthOffset", 0.f); float heightOffsetPercent = pNewNode.GetFloatProperty("heightOffset", 0.f); CTexture* bar = tm->GetTexture(texture_bar); CTexture* back = tm->GetTexture(texture_back); uint32 widthOffset = (uint32) (screenResolution.x * 0.01f * widthOffsetPercent ); uint32 heightOffset = (uint32) (screenResolution.y * 0.01f * heightOffsetPercent ); progressBar = new CProgressBar( screenResolution.y,screenResolution.x, h, w, Vect2f(posx, posy), l_literal, heightOffset, widthOffset, visible, activated); progressBar->SetName(name); progressBar->SetTextures(back, bar); progressBar->SetFont(idFont, CColor(color_font_r,color_font_g,color_font_b)); progressBar->SetOnComplete(OnComplete); *progressBar_aux = progressBar; }
bool CTextureRenderTarget::Init(CXMLTreeNode& _treeRenderTarget) { string l_szName = _treeRenderTarget.GetPszISOProperty("name","",false); string l_szTextureName = _treeRenderTarget.GetPszISOProperty("texture","",false); string l_szFormat = _treeRenderTarget.GetPszISOProperty("format","A8R8G8B8"); int l_iWidth = (int)CORE->GetRenderManager()->GetScreenWidth(); float l_fSize = _treeRenderTarget.GetFloatProperty("size",1.f,false); m_iWidth = _treeRenderTarget.GetIntProperty("width" ,(int)(RENDER_MANAGER->GetScreenWidth() * l_fSize),false); m_iHeight = _treeRenderTarget.GetIntProperty("height",(int)(RENDER_MANAGER->GetScreenHeight() * l_fSize),false); CRenderTarget::Init(m_iWidth, m_iHeight); SetOk(true); if(l_szName != "") { SetName(l_szName); if(l_szTextureName != "") { m_szTextureName = l_szTextureName; CTexture* l_pTexture = new CTexture(); if(l_pTexture->Create(l_szTextureName, m_iWidth, m_iHeight, 1, CTexture::RENDERTARGET, CTexture::DEFAULT, CTexture::GetFormatTypeFromString(l_szFormat))) { m_pSurface = l_pTexture->GetSurface(); m_pSurface->AddRef(); } else { m_pSurface = 0; } if(l_pTexture->IsOk() && m_pSurface) { SetOk(true); CORE->GetTextureManager()->AddResource(l_szTextureName, l_pTexture); } else { if(!l_pTexture->IsOk()) LOGGER->AddNewLog(ELL_ERROR, "CTextureRenderTarget::Init Texture is not Ok."); if(!m_pSurface) LOGGER->AddNewLog(ELL_ERROR, "CTextureRenderTarget::Init Surface is not Ok."); SetOk(false); CHECKED_DELETE(l_pTexture); } }else{ LOGGER->AddNewLog(ELL_WARNING,"CTextureRenderTarget::Init render_target sense textura"); SetOk(false); } }else{ LOGGER->AddNewLog(ELL_WARNING,"CTextureRenderTarget::Init render_target sense nom"); SetOk(false); } return IsOk(); }
void CGUIWindow::LoadAnimatedImage(CAnimatedImage** image_aux, CXMLTreeNode& pNewNode, const Vect2i& screenResolution, CTextureManager* tm) { //<AnimatedImage name="imageRoomSelected_gameserver2" posx="35" posy="20" height="40" width="30" visible="true" active="true" //default="q3dm1" isAnimated="true", time="0" loop="true" OnSaveValue="blabla" OnLoadValue="blabla" Literal="blabla" //widthOffset="" heightOffset="" flip="" Literal="blabla" widthOffset="" heightOffset=""/> // <texture name="q3dm1" texture="gui_q3dm1_off.jpg"/> // <texture name="q3dm2" texture="gui_q3dm2_off.jpg"/> // ... //</Image> CAnimatedImage* image; std::string name = pNewNode.GetPszProperty("name", "defaultGuiElement"); float posx = pNewNode.GetFloatProperty("posx", 0.f); float posy = pNewNode.GetFloatProperty("posy", 0.f); float w = pNewNode.GetFloatProperty("width", 50.f); float h = pNewNode.GetFloatProperty("height", 50.f); bool visible = pNewNode.GetBoolProperty("visible", true); bool activated = pNewNode.GetBoolProperty("active", true); uint16 initFrame = pNewNode.GetIntProperty("initFrame", true); bool playOnLoad = pNewNode.GetBoolProperty("playOnLoad", true); std::string OnSaveValue = pNewNode.GetPszProperty("OnSaveValue", ""); std::string OnLoadValue = pNewNode.GetPszProperty("OnLoadValue", ""); std::string flip = pNewNode.GetPszProperty("flip", ""); bool backGround = pNewNode.GetBoolProperty("backGround", false); std::string l_literal = pNewNode.GetPszProperty("Literal", ""); float widthOffsetPercent = pNewNode.GetFloatProperty("widthOffset", 0.f); float heightOffsetPercent = pNewNode.GetFloatProperty("heightOffset", 0.f); uint32 widthOffset = (uint32) (screenResolution.x * 0.01f * widthOffsetPercent ); uint32 heightOffset = (uint32) (screenResolution.y * 0.01f * heightOffsetPercent ); image = new CAnimatedImage( screenResolution.y,screenResolution.x, h, w, Vect2f(posx,posy), l_literal, heightOffset, widthOffset, visible, activated); image->SetName(name); image->SetOnLoadValueAction(OnLoadValue); image->SetOnSaveValueAction(OnSaveValue); image->SetBackGround(backGround); if( flip.compare("FLIP_X") == 0) { image->SetFlip(FLIP_X); } else if (flip.compare("FLIP_Y") == 0) { image->SetFlip(FLIP_Y); } else { image->SetFlip(NONE_FLIP); } int count = pNewNode.GetNumChildren(); for (int j = 0; j < count; ++j) { CXMLTreeNode pTexture = pNewNode(j); std::string tagName = pTexture.GetName(); if (tagName.compare("texture")==0) { std::string texture = pNewNode(j).GetPszProperty("name_texture"); CTexture* texture_image = tm->GetTexture(texture); image->AddFrame(texture_image); } } image->GoToFrame(initFrame); if (playOnLoad) { //image->PlayAnimation(); } *image_aux = image; }
void CGUIWindow::LoadRadioBox(CRadioBox** radioBox_aux, CXMLTreeNode& pNewNode, const Vect2i& screenResolution, CTextureManager* tm) { //<RadioBox name="pepito" posx="0" posy="2" height="10" width="10" default_checkButton="bla" visible="true" active="true" texture_back="" // columns="3" rows="3" OnCheckOn="blabla" OnCheckOff="blabla" OnOverButton="blabla" // OnSaveValue="blabl" OnLoadValue="" Literal="blabla" widthOffset="" heightOffset=""/> // <texture name="q3dm1" on="gui_q3dm1_on.jpg" off="gui_q3dm1_off.jpg" deactivated="gui_q3dm1_on.jpg" /> // <texture name="q3dm2" on="gui_q3dm2_on.jpg" off="gui_q3dm2_off.jpg" deactivated="gui_q3dm2_on.jpg" /> // ... //</RadioBox> CRadioBox* radioBox; std::string name = pNewNode.GetPszProperty("name", "defaultGuiElement"); float posx = pNewNode.GetFloatProperty("posx", 0.f); float posy = pNewNode.GetFloatProperty("posy", 0.f); float w = pNewNode.GetFloatProperty("width", 50.f); float h = pNewNode.GetFloatProperty("height", 50.f); bool visible = pNewNode.GetBoolProperty("visible", true); bool activated = pNewNode.GetBoolProperty("active", true); std::string default_checkButton = pNewNode.GetPszProperty("default_checkButton", ""); std::string texture_back = pNewNode.GetPszProperty("texture_back", ""); uint32 columns = pNewNode.GetIntProperty("columns", 0); uint32 rows = pNewNode.GetIntProperty("rows", 0); std::string OnCheckOn = pNewNode.GetPszProperty("OnCheckOn", ""); std::string OnCheckOff = pNewNode.GetPszProperty("OnCheckOff", ""); std::string OnOverButton = pNewNode.GetPszProperty("OnOverButton", ""); std::string OnSaveValue = pNewNode.GetPszProperty("OnSaveValue", ""); std::string OnLoadValue = pNewNode.GetPszProperty("OnLoadValue", ""); std::string l_literal = pNewNode.GetPszProperty("Literal", ""); float widthOffsetPercent = pNewNode.GetFloatProperty("widthOffset", 0.f); float heightOffsetPercent = pNewNode.GetFloatProperty("heightOffset", 0.f); uint32 widthOffset = (uint32) (screenResolution.x * 0.01f * widthOffsetPercent ); uint32 heightOffset = (uint32) (screenResolution.y * 0.01f * heightOffsetPercent ); radioBox = new CRadioBox( screenResolution.y,screenResolution.x,h, w, Vect2f(posx,posy), columns, rows, default_checkButton, l_literal, heightOffset, widthOffset, visible, activated); if (texture_back!="") { CTexture* quad = tm->GetTexture(texture_back); radioBox->SetTextureBack(quad); } radioBox->SetName(name); radioBox->SetOnLoadValueAction(OnLoadValue); radioBox->SetOnSaveValueAction(OnSaveValue); //radioBox->SetCheckButtonActions(OnCheckOn, OnCheckOff, OnOverButton); int count = pNewNode.GetNumChildren(); for (int j = 0; j < count; ++j) { CXMLTreeNode pTexture = pNewNode(j); std::string tagName = pTexture.GetName(); if (tagName.compare("texture")==0) { std::string name = pTexture.GetPszProperty("name"); std::string on = pTexture.GetPszProperty("on"); std::string off = pTexture.GetPszProperty("off"); std::string deactivated = pTexture.GetPszProperty("deactivated"); CTexture* texture_on = tm->GetTexture(on); CTexture* texture_off = tm->GetTexture(off); CTexture* texture_deactivated = tm->GetTexture(deactivated); radioBox->SetCheckButton(name, texture_on, texture_off, texture_deactivated); } } radioBox->SetCheckButtonActions(OnCheckOn, OnCheckOff, OnOverButton); *radioBox_aux = radioBox; }
bool CGUIWindow::LoadXML( const std::string &xmlGuiFile, const Vect2i& screenResolution) { //Read the xml gui file LOGGER->AddNewLog(ELL_INFORMATION, "CGUIWindow:: Iniciando el parseo del fichero %s", xmlGuiFile.c_str()); bool isOK = false; CXMLTreeNode newFile; if (!newFile.LoadFile(xmlGuiFile.c_str())) { LOGGER->AddNewLog(ELL_ERROR, "CGUIWindow:: No se ha podido leer correctamente el fichero ->%s", xmlGuiFile.c_str()); isOK = false; } else { CTextureManager* textureM = CORE->GetTextureManager(); CXMLTreeNode windows = newFile["Windows"]; m_sLuaCode_OnLoadWindows = windows.GetPszProperty("OnLoadWindows"); m_sLuaCode_OnSaveWindows = windows.GetPszProperty("OnSaveWindows"); m_sLuaCode_OnUpdateWindows = windows.GetPszProperty("OnUpdateWindows"); if (windows.Exists()) { int count = windows.GetNumChildren(); for (int i = 0; i < count; ++i) { CXMLTreeNode pNewNode = windows(i); //Para cada guielement leemos su informacion comun--> std::string name = pNewNode.GetPszProperty("name", "defaultGuiElement"); float posx = pNewNode.GetFloatProperty("posx", 0.f); float posy = pNewNode.GetFloatProperty("posy", 0.f); float w = pNewNode.GetFloatProperty("width", 50.f); float h = pNewNode.GetFloatProperty("height", 50.f); bool visible = pNewNode.GetBoolProperty("visible", true); bool activated = pNewNode.GetBoolProperty("active", true); std::string tagName = pNewNode.GetName(); if (tagName.compare("Button")==0) { CButton* newButton = NULL; LoadButton(&newButton,pNewNode,screenResolution, textureM); AddGuiElement(newButton); } else if (tagName.compare("CheckButton")==0) { CCheckButton* new_checkButton = NULL; LoadCheckButton(&new_checkButton,pNewNode,screenResolution, textureM); AddGuiElement(new_checkButton); } else if (tagName.compare("Slider")==0) { CSlider* new_slider = NULL; LoadSlider(&new_slider,pNewNode,screenResolution, textureM); AddGuiElement(new_slider); } else if (tagName.compare("DialogBox")==0) { CDialogBox* new_dialogBox = NULL; LoadDialogBox(&new_dialogBox,pNewNode,screenResolution, textureM); AddGuiElement(new_dialogBox); } else if (tagName.compare("EditableTextBox")==0) { CEditableTextBox* new_editableTextBox = NULL; LoadEditableTextBox(&new_editableTextBox,pNewNode,screenResolution, textureM); AddGuiElement(new_editableTextBox); } else if (tagName.compare("RadioBox")==0) { CRadioBox* new_radioBox = NULL; LoadRadioBox(&new_radioBox,pNewNode,screenResolution, textureM); AddGuiElement(new_radioBox); } else if (tagName.compare("Image")==0) { CImage* new_image = NULL; _LoadImage(&new_image,pNewNode,screenResolution, textureM); AddGuiElement(new_image); } else if (tagName.compare("AnimatedImage")==0) { CAnimatedImage* new_image = NULL; LoadAnimatedImage(&new_image,pNewNode,screenResolution, textureM); AddGuiElement(new_image); } else if (tagName.compare("ProgressBar")==0) { CProgressBar* new_progressBar = NULL; LoadProgressBar(&new_progressBar,pNewNode,screenResolution, textureM); AddGuiElement(new_progressBar); } else if (tagName.compare("StaticText")==0) { CStaticText* new_staticText = NULL; LoadStaticText(&new_staticText,pNewNode,screenResolution, textureM); AddGuiElement(new_staticText); } else if (tagName.compare("KeyBoard_Back")==0) { //<KeyBoard_Back input="DIK_A" OnKeyDown="blablaLua"/> m_sLuaCode_OnKeyDown = pNewNode.GetPszProperty("OnKeyDown", ""); m_uInputKeyDown = pNewNode.GetIntProperty("input", 0); } else { //Warning LOGGER->AddNewLog(ELL_WARNING, "GUIWindow:: No se reconoce el tag %s del fichero %s", tagName.c_str(), xmlGuiFile.c_str()); } } isOK = true; } else { LOGGER->AddNewLog(ELL_ERROR, "GUIWindow:: No se ha podido leer el tag Windows del fichero ->%s", xmlGuiFile.c_str()); isOK = false; } }//END else de if (!newFile.LoadFile(xmlGuiFile.c_str())) if (!isOK) { LOGGER->AddNewLog(ELL_ERROR, "GUIWindow:: No se ha podido leer correctamente el fichero -->%s", xmlGuiFile.c_str()); isOK = false; } else { LOGGER->AddNewLog(ELL_INFORMATION, "GUIWindow:: Finalizado correctamente el parseo el fichero %s", xmlGuiFile.c_str()); } return isOK; }
/// <summary> /// Carga el .xml de sonido. /// </summary> ///<param name="&FileName">Ubicación del archivo xml.</param> bool CSoundManager::Load(const std::string &FileName) { SSoundData soundData; bool l_bIsOk = true; m_FileName = FileName; CXMLTreeNode filexml; if (!filexml.LoadFile(m_FileName.c_str())) { // Guarda mensaje de error en el log std::string msg_error = "CSoundManager::Load->Error al intentar abrir el archivo: "; msg_error.append(m_FileName.c_str()); LOGGER->AddNewLog(ELL_ERROR, msg_error.c_str()); throw CException(__FILE__, __LINE__, msg_error); l_bIsOk = false; } else { CXMLTreeNode cores = filexml["sounds"]; if (cores.Exists()) { m_iMaxChannels = cores.GetIntProperty("maxChannels"); // Asignando número de canales de acuerdo al parametro extraído del .xml m_Channels.resize(m_iMaxChannels); if (!cores.IsComment()) { int32 numNodes = cores.GetNumChildren(); for(int i=0; i < numNodes; i++) { if (!cores(i).IsComment()) { // Recibe parametros de los sonidos std::string l_sCoreName = cores(i).GetPszProperty("name"); std::string l_sCoreType = cores(i).GetPszProperty("type"); std::string l_sCorePath = cores(i).GetPszProperty("path"); bool l_bCoreLoop = cores(i).GetBoolProperty("loop"); bool l_bCore3D = cores(i).GetBoolProperty("threeDimensional"); std::string l_sCorePriority = cores(i).GetPszProperty("priority"); std::string l_sCoreEffect = cores(i).GetPszProperty("effect"); float l_fCoreVolume = cores(i).GetFloatProperty("volume"); int iMask = 0; int PathLastCharacters = l_sCorePath.length() - 3; std::string substring = l_sCorePath.substr(PathLastCharacters,3); if (substring != "wav") { // Convert the sample (MP3/MP2/MP1 only) to mono, if it's not already. iMask = BASS_SAMPLE_MONO; } // Asigna propiedad de loop if (l_bCoreLoop) { iMask |= BASS_SAMPLE_LOOP; soundData.m_Loop = true; } else { soundData.m_Loop = false; } // Asigna propiedad 3D y posición 3D if (l_bCore3D) { iMask |= BASS_SAMPLE_3D; soundData.m_ThreeDimensional = true; soundData.m_Position = cores(i).GetVect3fProperty("position", Vect3f(0.0, 0.0, 0.0)); } else { soundData.m_ThreeDimensional = false; } if (l_sCoreType == "sample") { // Genera identificador para sonido soundData.m_type = SAMPLER; soundData.m_Id = BASS_SampleLoad(false, l_sCorePath.c_str(), 0, 0, m_iMaxChannels, iMask); } else { // Genera identificador para música soundData.m_Id = BASS_StreamCreateFile(false, l_sCorePath.c_str(), 0, 0, iMask); soundData.m_type = BGM; } // Añadiendo volumen soundData.m_Volume = l_fCoreVolume; // Añade sonido al mapa m_Resources[l_sCoreName] = soundData; } } } } else { l_bIsOk = false; } } return l_bIsOk; }
bool CSpirit::LoadXML(std::string fileName) { m_pFileName = fileName; CXMLTreeNode header; if(!header.LoadFile(fileName.c_str())) { //Guardar el mensaje de error en el LOGGER std::string msg_error = " CSpirit::Load->Error al intentar abrir el archivo: "; msg_error.append(fileName.c_str()); LOGGER->AddNewLog(ELL_ERROR, msg_error.c_str()); //throw CException(__FILE__, __LINE__, msg_error); return false; } else { //<spirit> //<parameters posini="3 2 -3" apertura="0.2" speedup="3.3" speeddown="0.5" heightflymax="3.0" heightflymin="1.9" //speedslow="1.0" speedfast="1.5" distnear="4.0" distfar="6.0" //timeidle="5.0" timechase="5.0" //numlaps="2" speedcontento="4.0" ///> //</spirit> //solo un spirit**** CXMLTreeNode tag = header["spirit"]; if(tag.Exists()) { if (!tag.IsComment()) { CXMLTreeNode params = tag(0)["parameters"]; if (params.Exists()) { m_V3PosIni = params.GetVect3fProperty("posini", Vect3f(3.0f, 1.5f, -3.8f)); // m_V3Pos = params.GetVect3fProperty("posini", Vect3f(3.0f, 1.5f, -3.8f)); //quitado para dejar estatico el espiritu m_fSpeed_YUp = params.GetFloatProperty("speedup",3.3f); m_fSpeed_YDown = params.GetFloatProperty("speeddown",0.5f); m_fPosYMax = params.GetFloatProperty("heightflymax",3.f); m_fPosYMin = params.GetFloatProperty("heightflymin",1.9f); m_fAperturaEmisor = params.GetFloatProperty("apertura",0.2f); m_fSpeedMax = params.GetFloatProperty("speedfast",1.5f); m_fSpeedMin = params.GetFloatProperty("speedslow",1.f); m_fDistFar = params.GetFloatProperty("distfar",6.f); m_fDistNear = params.GetFloatProperty("distnear",10.f); m_fDelayTimeIdle = params.GetFloatProperty("timeidle",5.f); m_fDelayTimeChase = params.GetFloatProperty("timechase",5.f); m_uiNumeroVueltasContento = params.GetIntProperty("numlaps",1); m_fSpeedRotationContento = params.GetFloatProperty("speedcontento",3.f); m_pLight = CORE->GetLigthManager()->GetResource(params.GetPszProperty("light", "")); } } } else { //Guardar el mensaje de error en el LOGGER std::string msg_error = " CSpirit::Load->Parametros mal configurados "; msg_error.append(fileName.c_str()); LOGGER->AddNewLog(ELL_ERROR, msg_error.c_str()); //throw CException(__FILE__, __LINE__, msg_error); return false; } } return true; }