当前位置: 首页>>代码示例>>C++>>正文


C++ DeviceInterface::getSupportedSensoryEffects方法代码示例

本文整理汇总了C++中DeviceInterface::getSupportedSensoryEffects方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceInterface::getSupportedSensoryEffects方法的具体用法?C++ DeviceInterface::getSupportedSensoryEffects怎么用?C++ DeviceInterface::getSupportedSensoryEffects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DeviceInterface的用法示例。


在下文中一共展示了DeviceInterface::getSupportedSensoryEffects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: all


//.........这里部分代码省略.........
		for(unsigned int i=0;i<envPath.length();i++)
		{
			if (envPath[i] == '\\'){
				envPath.insert(i,1,'\\');
				i++;
			}
		}
	
		plgsPath = envPath;
	
		plgsPath.append("\\\\plugins.csv");
		plugins.open(plgsPath.c_str(),ios::out | ios::binary);
	}

	if(plugins.fail())
	{
		cout << "Error opening:"<< plgsPath << endl;
		MessageBox(NULL,plgsPath.c_str(),"Ambient Library - Error", MB_OK);
		errorMessage = DEVICE_ERROR_OPEN_DRIVER_LIST ;
	}else
	{
		while(plugins.good()){

			getline(plugins,line);
			all.append(line);
		}
	}
	plugins.close();

	// parse the file
	//MessageBox(NULL,all.c_str(), "MUH", MB_OK);
	std::vector<std::string> devs = Utils::StringSplit(all,";");
	
	// now we know which drivers to load, because the number after every dll specifies which ones we are going to load

	// after loading the dll, query it and save which effects it can handle

	for(unsigned int i=0;i<devs.size();i+=2){
	
		if(atoi(devs[i+1].c_str()) == LOAD_DRIVER)
		{
			
			wchar_t *libText;
			std::string pt = envPath;
			pt.append("\\\\plugins\\\\");
			
			
			pt.append(devs[i].c_str());
			
			libText = new wchar_t[strlen(pt.c_str())+1];
			memset(libText,0,strlen(pt.c_str())+1);
			MultiByteToWideChar(CP_ACP,NULL,pt.c_str(),-1,libText,strlen(pt.c_str())+1);
			
			drv = LoadLibrary(pt.c_str());
			delete []libText;
		
			if(drv != NULL){
				
				// dll got loaded properly

				// get our entrypoint
				InitDeviceDriverPtr = (ctor_b_InitDeviceDriver) GetProcAddress(drv,"ctor_b_InitDeviceDriver");

				if (NULL != InitDeviceDriverPtr)
				{
					// add the driver to our list
					DeviceInterface *devI = InitDeviceDriverPtr(disableFateTime);	

					ptr<std::vector<int>> vec;				// we are responsible for the vector ...

					vec = new std::vector<int>();			

					devI->getSupportedSensoryEffects(vec);

					devices.insert(pair<DeviceInterface *,ptr<std::vector<int>>>(devI,vec));
					// now we have our driver loaded
			    	cout << "Loaded device driver successfuly!"<< endl;
					
					loadedPlugins.push_back(drv);
					
				}else{
					std::string error_msg;
					error_msg.append("Error at loading driver: ");
					error_msg.append(devs[i].c_str());
					MessageBox(NULL, error_msg.c_str(), "Ambient Library - Error", MB_OK);
					cout << "Error at loading driver: "<< devs[i].c_str() << endl;
					errorMessage = DEVICE_ERROR_LOADING_DRIVERS;
					FreeLibrary(drv);
				}

			}else{
				cout << "No such device driver could be found: " << devs[i].c_str() << endl;
			}

		}else{

			//MessageBox(NULL, devs[i].c_str(), "Not Loading..", MB_OK);
		}
	}
}
开发者ID:dazedsheep,项目名称:AmbientLib,代码行数:101,代码来源:DeviceContext.cpp


注:本文中的DeviceInterface::getSupportedSensoryEffects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。