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


C++ Profile::GetAxisMapperList方法代码示例

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


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

示例1: AutoBind

int ConfigurationFile::AutoBind(const string& directory, const string& file)
{
  ConfigurationFile refConfigFile;

  int ret = refConfigFile.ReadConfigFile(directory, file);

  if(ret >= 0)
  {
    for(int i=0; i<MAX_CONTROLLERS; ++i)
    {
      Controller* refController = refConfigFile.GetController(i);
      Controller* modController = GetController(i);
      for(int j=0; j<MAX_PROFILES; ++j)
      {
        Profile* refConfig = refController->GetProfile(j);
        Profile* modConfig = modController->GetProfile(j);

        modConfig->SetTrigger(*refConfig->GetTrigger());
        modConfig->SetIntensityList(*refConfig->GetIntensityList());

        AutoBindMappers<ControlMapper>(refConfig->GetButtonMapperList(), modConfig->GetButtonMapperList());

        AutoBindMappers<ControlMapper>(refConfig->GetAxisMapperList(), modConfig->GetAxisMapperList());
      }
    }
  }

  return ret;
}
开发者ID:matlo,项目名称:GIMX,代码行数:29,代码来源:ConfigurationFile.cpp

示例2: ConvertSensitivity

int ConfigurationFile::ConvertSensitivity(const string& directory, const string& file)
{
  ConfigurationFile refConfigFile;

  int ret = refConfigFile.ReadConfigFile(directory, file);

  if(ret >= 0)
  {
    for(int i=0; i<MAX_CONTROLLERS; ++i)
    {
      Controller* refController = refConfigFile.GetController(i);
      Controller* modController = GetController(i);

      int refdpi = refController->GetMouseDPI();
      int dpi = modController->GetMouseDPI();

      if(refdpi && dpi && refdpi != dpi)
      {
        for(int k=0; k<MAX_PROFILES; ++k)
        {
          Profile* modConfig = modController->GetProfile(k);

          list<ControlMapper>* modAxisMappers = modConfig->GetAxisMapperList();

          for(list<ControlMapper>::iterator itModControlMappers = modAxisMappers->begin(); itModControlMappers!=modAxisMappers->end(); ++itModControlMappers)
          {
            if(itModControlMappers->GetDevice()->GetType() == "mouse" && itModControlMappers->GetEvent()->GetType() == "axis")
            {
                double val = atof(itModControlMappers->GetEvent()->GetMultiplier().c_str());
                double exp = atof(itModControlMappers->GetEvent()->GetExponent().c_str());
                val = val * pow((double)dpi / refdpi, exp);
                ostringstream ios;
                ios << setprecision(2) << val;
                itModControlMappers->GetEvent()->SetMultiplier(ios.str());
            }
          }
        }

        modController->SetMouseDPI(refdpi);
      }
    }
  }

  return ret;

}
开发者ID:matlo,项目名称:GIMX,代码行数:46,代码来源:ConfigurationFile.cpp

示例3: GetLabels

void ConfigurationFile::GetLabels(list<string>& button_labels, list<string>& axis_labels)
{
  for(int i=0; i<MAX_CONTROLLERS; ++i)
  {
    Controller* controller = GetController(i);

    for(int k=0; k<MAX_PROFILES; ++k)
    {
      Profile* config = controller->GetProfile(k);

      list<ControlMapper>* buttonMappers = config->GetButtonMapperList();

      for(list<ControlMapper>::iterator itButtonMappers = buttonMappers->begin(); itButtonMappers!=buttonMappers->end(); ++itButtonMappers)
      {
        string label = itButtonMappers->GetLabel();
        if(!label.empty())
        {
          list<string> tokens = split(label, ',');
          for(list<string>::iterator tk_it = tokens.begin(); tk_it != tokens.end(); ++tk_it)
          {
            if(!tk_it->empty() && *tk_it != "not found" && *tk_it != "duplicate")
            {
              string tk = *tk_it;
              transform(tk.begin(), tk.end(), tk.begin(), (int(*)(int)) tolower);
              list<string>::iterator bl_it;
              for(bl_it = button_labels.begin(); bl_it != button_labels.end(); ++bl_it)
              {
                string bl = *bl_it;
                transform(bl.begin(), bl.end(), bl.begin(), (int(*)(int)) tolower);
                if(tk == bl)
                {
                  break;
                }
              }
              if(bl_it == button_labels.end())
              {
                button_labels.push_back(*tk_it);
              }
            }
          }
        }
      }

      list<ControlMapper>* axisMappers = config->GetAxisMapperList();

      for(list<ControlMapper>::iterator itControlMappers = axisMappers->begin(); itControlMappers!=axisMappers->end(); ++itControlMappers)
      {
        string label = itControlMappers->GetLabel();
        if(!label.empty())
        {
          list<string> tokens = split(label, ',');
          for(list<string>::iterator tk_it = tokens.begin(); tk_it != tokens.end(); ++tk_it)
          {
            if(!tk_it->empty() && *tk_it != "not found" && *tk_it != "duplicate")
            {
              string tk = *tk_it;
              transform(tk.begin(), tk.end(), tk.begin(), (int(*)(int)) tolower);
              list<string>::iterator al_it;
              for(al_it = axis_labels.begin(); al_it != axis_labels.end(); ++al_it)
              {
                string al = *al_it;
                transform(al.begin(), al.end(), al.begin(), (int(*)(int)) tolower);
                if(al == tk)
                {
                  break;
                }
              }
              if(al_it == axis_labels.end())
              {
                axis_labels.push_back(*tk_it);
              }
            }
          }
        }
      }
    }
  }
}
开发者ID:matlo,项目名称:GIMX,代码行数:78,代码来源:ConfigurationFile.cpp


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