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


C++ Box::GetIsDynamic方法代码示例

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


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

示例1: file

bool LevelReaderWriter::SaveAsTextV0(const std::string& _filePath, const Player& _player, const std::vector<Box>& _boxes,
  const std::vector<Box>& _obstacles, const std::vector<Coins>& _coins, const Box& _exit, const Box& _trigger,
  const std::vector<Light>& _lights, const std::vector<EnemyRobot>& _enemies)
{
  std::ofstream file(_filePath);
  if (file.fail())
  {
    perror(_filePath.c_str());
    return false;
  }

  //write version
  file << TEXT_VERSION << "\n";
  //write player
  file << _player.GetPosition().x << ' ' << _player.GetPosition().y << ' '
    << _player.GetDrawDims().x << ' ' << _player.GetDrawDims().y << ' '
    << _player.GetColDims().x << ' ' << _player.GetColDims().y << ' '
    << _player.GetColor().r << ' ' << _player.GetColor().g << ' '
    << _player.GetColor().b << ' ' << _player.GetColor().a << '\n';

  //write the exit
  file << _exit.GetPosition().x << ' ' << _exit.GetPosition().y << ' '
    << _exit.GetDimensions().x << ' ' << _exit.GetDimensions().y << ' '
    << _exit.GetColor().r << ' ' << _exit.GetColor().g << ' '
    << _exit.GetColor().b << ' ' << _exit.GetColor().a << ' '
    << _exit.GetUvRect().x << ' ' << _exit.GetUvRect().y << ' '
    << _exit.GetUvRect().z << ' ' << _exit.GetUvRect().w << ' '
    << _exit.GetAngle() << ' ' << _exit.GetTexture().filePath << ' '
    << _exit.GetIsDynamic() << ' ' << _exit.GetFixedRotation() << ' '
    << _exit.GetIsSensor() << '\n';

  //write the trigger(switch)
  file << _trigger.GetPosition().x << ' ' << _trigger.GetPosition().y << ' '
    << _trigger.GetDimensions().x << ' ' << _trigger.GetDimensions().y << ' '
    << _trigger.GetColor().r << ' ' << _trigger.GetColor().g << ' '
    << _trigger.GetColor().b << ' ' << _trigger.GetColor().a << ' '
    << _trigger.GetUvRect().x << ' ' << _trigger.GetUvRect().y << ' '
    << _trigger.GetUvRect().z << ' ' << _trigger.GetUvRect().w << ' '
    << _trigger.GetAngle() << ' ' << _trigger.GetTexture().filePath << ' '
    << _trigger.GetIsDynamic() << ' ' << _trigger.GetFixedRotation() << ' '
    << _trigger.GetIsSensor() << '\n';

  //write the number of boxes
  file << _boxes.size() << "\n";

  //write all the boxes
  for (auto& b : _boxes)
  {
    file << b.GetPosition().x << ' ' << b.GetPosition().y << ' '
      << b.GetDimensions().x << ' ' << b.GetDimensions().y << ' '
      << b.GetColor().r << ' ' << b.GetColor().g << ' '
      << b.GetColor().b << ' ' << b.GetColor().a << ' '
      << b.GetUvRect().x << ' ' << b.GetUvRect().y << ' '
      << b.GetUvRect().z << ' ' << b.GetUvRect().w << ' '
      << b.GetAngle() << ' ' << b.GetTexture().filePath << ' '
      << b.GetIsDynamic() << ' ' << b.GetFixedRotation() << ' '
      << b.GetIsSensor() << '\n';
  }

  //write the number of obstacles
  file << _obstacles.size() << "\n";
  //write all the obstacles
  for (auto& obs : _obstacles)
  {
    file << obs.GetPosition().x << ' ' << obs.GetPosition().y << ' '
      << obs.GetDimensions().x << ' ' << obs.GetDimensions().y << ' '
      << obs.GetColor().r << ' ' << obs.GetColor().g << ' '
      << obs.GetColor().b << ' ' << obs.GetColor().a << ' '
      << obs.GetUvRect().x << ' ' << obs.GetUvRect().y << ' '
      << obs.GetUvRect().z << ' ' << obs.GetUvRect().w << ' '
      << obs.GetAngle() << ' ' << obs.GetTexture().filePath << ' '
      << obs.GetIsDynamic() << ' ' << obs.GetFixedRotation() << ' '
      << obs.GetIsSensor() << '\n';
  }

  //write the number of lights
  file << _lights.size() << "\n";
  for (auto& light : _lights)
  {
    file << light.position.x << ' ' << light.position.y << ' ' << light.size << ' ' <<
      light.color.r << ' ' << light.color.g << ' ' << light.color.b << ' ' << light.color.a << '\n';
  }

  //write the number of enemies
  file << _enemies.size() << "\n";
  for (auto& enemy : _enemies)
  {
    //write player
    file << enemy.GetPosition().x << ' ' << enemy.GetPosition().y << ' '
      << enemy.GetDrawDims().x << ' ' << enemy.GetDrawDims().y << ' '
      << enemy.GetColDims().x << ' ' << enemy.GetColDims().y << ' '
      << enemy.GetColor().r << ' ' << enemy.GetColor().g << ' '
      << enemy.GetColor().b << ' ' << enemy.GetColor().a << '\n';
  }

  //write the number of obstacles
  file << _coins.size() << "\n";
  //write all the obstacles
  for (auto& coin : _coins)
  {
//.........这里部分代码省略.........
开发者ID:VasilStamatov,项目名称:GraphicsLearning,代码行数:101,代码来源:LevelReaderWriter.cpp


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