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


C++ Sector类代码示例

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


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

示例1: tglEnable

void GfxTinyGL::startActorDraw(Graphics::Vector3d pos, float scale, float yaw, float pitch, float roll) {
	tglEnable(TGL_TEXTURE_2D);
	tglMatrixMode(TGL_MODELVIEW);
	tglPushMatrix();
	if (_currentShadowArray) {
		// TODO find out why shadowMask at device in woods is null
		if (!_currentShadowArray->shadowMask) {
			_currentShadowArray->shadowMask = new byte[_screenWidth * _screenHeight];
			_currentShadowArray->shadowMaskSize = _screenWidth * _screenHeight;
		}
		assert(_currentShadowArray->shadowMask);
		//tglSetShadowColor(255, 255, 255);
		tglSetShadowColor(_shadowColorR, _shadowColorG, _shadowColorB);
		tglSetShadowMaskBuf(_currentShadowArray->shadowMask);
		SectorListType::iterator i = _currentShadowArray->planeList.begin();
		Sector *shadowSector = i->sector;
		tglShadowProjection(_currentShadowArray->pos, shadowSector->getVertices()[0], shadowSector->getNormal(), _currentShadowArray->dontNegate);
	}

	tglTranslatef(pos.x(), pos.y(), pos.z());
	tglScalef(scale, scale, scale);
	tglRotatef(yaw, 0, 0, 1);
	tglRotatef(pitch, 1, 0, 0);
	tglRotatef(roll, 0, 1, 0);
}
开发者ID:gmacon,项目名称:residual,代码行数:25,代码来源:gfx_tinygl.cpp

示例2: populateSystem

void Supervisor::populateSystem(int listenerSize,
                            int screamerSize, int LUASize, std::string filename)
{

    std::vector<int> LUAVector;

    for(uint i = 0; i < sectors.size(); i++)
    {
        LUAVector.push_back(0);
    }

    autonAmount = LUASize;
    luaFilename = filename;

    uint j = 0;
    for(int i = 0; i<LUASize; i++, j++)
    {
        if(i % sectors.size() == 0) j = 0;
        LUAVector.at(j)++;
    }
    //Output::Inst()->kdebug("working here! %i, %i", LUAVector.size(), LUAVector.at(0));
    j = 0;
    for(auto itr = LUAVector.begin(); itr != LUAVector.end(); ++itr, j++)
    {
        Sector *sector = sectors.at(j);
        //Output::Inst()->kdebug("Working not here %i", *itr);
        sector->populate(*itr, filename);
    }

}
开发者ID:heinzdmx,项目名称:RANA,代码行数:30,代码来源:supervisor.cpp

示例3: switch

void
EditorSectorsMenu::menu_action(MenuItem& item)
{
  if (item.get_id() >= 0)
  {
    Level* level = Editor::current()->get_level();
    Sector* sector = level->get_sector(item.get_id());
    Editor::current()->load_sector(sector->get_name());
    MenuManager::instance().clear_menu_stack();
  }
  else
  {
    switch (item.get_id())
    {
      case -1:
        break;

      case -2:
        create_sector();
        break;

      case -3:
        delete_sector();
        break;

      case -4:
        MenuManager::instance().clear_menu_stack();
        break;
    }
  }
}
开发者ID:HybridDog,项目名称:supertux,代码行数:31,代码来源:editor_sectors_menu.cpp

示例4: computeStartingSector

//-----------------------------------------------------------------------------
void SceneManagerPortals::extractVisibleActors(ActorCollection& list, const Camera* camera)
{
  if (cullingEnabled())
  {
    Sector* start = computeStartingSector(camera);
    if (!start)
      extractActors(list);
    else
    {
      ++mVisitTick;
      mTempActors.clear();
      mFrustumStack.clear();

      mFrustumStack.push_back(camera->frustum());
      start->executeCallbacks(camera,this,NULL);
      visitSector(NULL, start, camera->modelingMatrix().getT(), camera);

      // remove duplicates
      std::sort(mTempActors.begin(), mTempActors.end());
      std::vector< ref<Actor> >::iterator new_end = std::unique(mTempActors.begin(), mTempActors.end());
      for(std::vector< ref<Actor> >::iterator it = mTempActors.begin(); it != new_end; ++it)
        list.push_back(it->get());
    }
  }
  else
    extractActors(list);
}
开发者ID:kmatheussen,项目名称:Visualization-Library,代码行数:28,代码来源:SceneManagerPortals.cpp

示例5: shouldDrawShadow

bool Actor::shouldDrawShadow(int shadowId) {
	Shadow *shadow = &_shadowArray[shadowId];
	if (!shadow->active)
		return false;

	// Don't draw a shadow if the shadow caster and the actor are on different sides
	// of the the shadow plane.
	Sector *sector = shadow->planeList.front().sector;
	Math::Vector3d n = sector->getNormal();
	Math::Vector3d p = sector->getVertices()[0];
	float d = -(n.x() * p.x() + n.y() * p.y() + n.z() * p.z());

	p = getPos();
	// Move the tested point a bit above ground level.
	if (g_grim->getGameType() == GType_MONKEY4)
		p.y() += 0.01;
	else
		p.z() += 0.01;
	bool actorSide = n.x() * p.x() + n.y() * p.y() + n.z() * p.z() + d < 0.f;
	p = shadow->pos;
	bool shadowSide = n.x() * p.x() + n.y() * p.y() + n.z() * p.z() + d < 0.f;

	if (actorSide == shadowSide)
		return true;
	return false;
}
开发者ID:gbraad,项目名称:residualvm,代码行数:26,代码来源:actor.cpp

示例6: if

void
Brick::try_break(Player* player)
{
  if(sprite->get_action() == "empty")
    return;

  SoundManager::current()->play("sounds/brick.wav");
  Sector* sector = Sector::current();
  Player& player_one = *(sector->player);
  if(coin_counter > 0 ){
    sector->add_object(std::make_shared<BouncyCoin>(get_pos(), true));
    coin_counter--;
    player_one.get_status()->add_coins(1);
    if(coin_counter == 0)
      sprite->set_action("empty");
    start_bounce(player);
  } else if(breakable) {
    if(player){
      if(player->is_big()){
        start_break(player);
        return;
      } else {
        start_bounce(player);
        return;
      }
    }
    break_me();
  }
}
开发者ID:leyyin,项目名称:supertux,代码行数:29,代码来源:brick.cpp

示例7: computeStartingSector

//-----------------------------------------------------------------------------
void SceneManagerPortals::extractVisibleActors(ActorCollection& list, const Camera* camera)
{
  if (cullingEnabled())
  {
    Sector* start = computeStartingSector(camera);
    if (!start)
      extractActors(list);
    else
    {
      ++mVisitTick;
      mTempActors.clear();
      mFrustumStack.clear();

      mFrustumStack.push_back(camera->frustum());
      start->executeCallbacks(camera,this,NULL);
      visitSector(NULL, start, camera->modelingMatrix().getT(), camera);

      // insert portal actors
      if (showPortals())
      {
        for(std::map<Portal*, ref<Actor> >::const_iterator it = mPortalActorMap.begin(); it != mPortalActorMap.end(); ++it)
          mTempActors.push_back(it->second);
      }

      // mic fixme: isn't quicker to use sets instead of sort()+unique()?
      // avoid reporting duplicates
      std::sort(mTempActors.begin(), mTempActors.end());
      std::vector< ref<Actor> >::iterator new_end = std::unique(mTempActors.begin(), mTempActors.end());
      for(std::vector< ref<Actor> >::iterator it = mTempActors.begin(); it != new_end; ++it)
        list.push_back(it->get());
    }
  }
  else
    extractActors(list);
}
开发者ID:VizLibrary,项目名称:Visualization-Library,代码行数:36,代码来源:SceneManagerPortals.cpp

示例8: TEST

// Test case generated from prender.c printf statements
TEST(PlayerTest, MoveCrossedSegment) {
    Vertex vs1{1, 16};
    Vertex vs2{1, 2};
    Vertex vs3{5, 7};

    std::vector<Sector> sectors;
    Sector s1{0, 100};
    s1.set_number_of_points(4);
    s1.add_vertex(vs1);
    s1.add_vertex(vs2);
    s1.add_vertex(vs3);
    s1.add_neighbor(-1);
    s1.add_neighbor(1);
    sectors.push_back(s1);

    float FLOOR = 999;
    float CEILING = 1000;
    Sector s2{FLOOR, CEILING};
    sectors.push_back(s2);

    Vector3D<float> location{4.184440, 6, 0};

    float ANGLE = 30;
    Player player{location, ANGLE, s1};
    float dx = 0.190669;
    float dy = 0;
    player.move(dx, dy, sectors);

    Sector result = player.get_sector();
    EXPECT_EQ(FLOOR, result.get_floor());
    EXPECT_EQ(CEILING, result.get_ceiling());
    EXPECT_EQ(ANGLE, player.get_angle());
    EXPECT_EQ(location.getX()+dx, player.get_location().getX());
    EXPECT_EQ(location.getY()+dy, player.get_location().getY());
}
开发者ID:jdelgad,项目名称:3de,代码行数:36,代码来源:player_test.cpp

示例9: BouncyCoin

void
Brick::try_break(bool playerhit)
{
  if(sprite->get_action() == "empty")
    return;

  sound_manager->play("sounds/brick.wav");
  Sector* sector = Sector::current();
  Player& player = *(sector->player);
  if(coin_counter > 0) {
    sector->add_object(new BouncyCoin(get_pos()));
    coin_counter--;
    player.get_status()->add_coins(1);
    if(coin_counter == 0)
      sprite->set_action("empty");
    start_bounce();
  } else if(breakable) {
    if(playerhit){
      if(player.is_big()){
        start_break();
        return;
      } else {
        start_bounce();
        return;
      }
    }
   break_me();
  }
}
开发者ID:slackstone,项目名称:tuxjunior,代码行数:29,代码来源:block.cpp

示例10: upload

int upload(const char* file, const char* dst, Sector& client)
{
   CTimer timer;
   uint64_t t1 = timer.getTime();  // returns time in microseconds (usecs)

   struct stat s;
   stat(file, &s);
   cout << "uploading " << file << " of " << s.st_size << " bytes" << endl;

   SectorFile* f = client.createSectorFile();

   if (f->open(dst, SF_MODE::WRITE) < 0)
   {
      cout << "ERROR: unable to connect to server or file already exists." << endl;
      return -1;
   }

   bool finish = true;
   if (f->upload(file) < 0LL)
      finish = false;

   f->close();
   client.releaseSectorFile(f);

   if (finish)
   {
      float throughput = s.st_size * 8.0f / 1000000.0f / ((timer.getTime() - t1) / 1000000.0f);

      cout << "Uploading accomplished! " << "AVG speed " << throughput << " Mb/s." << endl << endl ;
   }
   else
      cout << "Uploading failed! Please retry. " << endl << endl;

   return 1;
}
开发者ID:norouzi4d,项目名称:sector,代码行数:35,代码来源:upload.cpp

示例11:

void
TitleScreen::make_tux_jump()
{
  static bool jumpWasReleased = true;
  Sector* sector  = titlesession->get_current_sector();
  Player* tux = sector->player;

  controller->update();
  controller->press(Controller::RIGHT);

  // Check if we should press the jump button
  Rectf lookahead = tux->get_bbox();
  lookahead.p2.x += 96;
  bool pathBlocked = !sector->is_free_of_statics(lookahead);
  if ((pathBlocked && jumpWasReleased) || !tux->on_ground()) {
    controller->press(Controller::JUMP);
    jumpWasReleased = false;
  } else {
    jumpWasReleased = true;
  }

  // Wrap around at the end of the level back to the beginning
  if(sector->get_width() - 320 < tux->get_pos().x) {
    sector->activate("main");
    sector->camera->reset(tux->get_pos());
  }
}
开发者ID:ed00m,项目名称:supertux,代码行数:27,代码来源:title_screen.cpp

示例12: L1_GetPointSector

/* Find the sector (of any type) which contains
 * the requested coordinate (x,y,z).
 */
void L1_GetPointSector() {
	lua_Object xObj = lua_getparam(1);
	lua_Object yObj = lua_getparam(2);
	lua_Object zObj = lua_getparam(3);
	lua_Object typeObj = lua_getparam(4);
	Sector::SectorType sectorType;

	if (!lua_isnumber(xObj) || !lua_isnumber(yObj) || !lua_isnumber(zObj)) {
		lua_pushnil();
		return;
	}
	if (lua_isnil(typeObj))
		sectorType = Sector::WalkType;
	else
		sectorType = (Sector::SectorType)(int)lua_getnumber(typeObj);

	float x = lua_getnumber(xObj);
	float y = lua_getnumber(yObj);
	float z = lua_getnumber(zObj);

	Graphics::Vector3d point(x, y, z);
	Sector *result = g_grim->getCurrScene()->findPointSector(point, sectorType);
	if (result) {
		lua_pushnumber(result->getSectorId());
		lua_pushstring(const_cast<char *>(result->getName()));
		lua_pushnumber(result->getType());
	} else {
		lua_pushnil();
	}
}
开发者ID:gmacon,项目名称:residual,代码行数:33,代码来源:lua_v1.cpp

示例13: main

int main(int argc, char** argv)
{
   if (argc > 2)
   {
      cerr << "USAGE: sector_fsck [path] \n";
      return -1;
   }

   Sector client;
   if (Utility::login(client) < 0)
      return 0;

   string path = "/";
   if (argc == 2)
      path = argv[1];

   //SysStat sys;
   int r = client.fsck(path);
   if (r >= 0)
      sys.print();
   else
      cerr << "Error happened, failed to retrieve any system information.\n";

   Utility::logout(client);

   return r;
}
开发者ID:deniskin82,项目名称:sector-sphere,代码行数:27,代码来源:fsck.cpp

示例14:

void
Level::save(const std::string& filename)
{
  lisp::Writer* writer = new lisp::Writer(filename);

  writer->write_comment("Level made using SuperTux's built-in Level Editor");

  writer->start_list("supertux-level");

  int version = 2;
  writer->write_int("version", version);

  writer->write_string("name", name, true);
  writer->write_string("author", author);
  if(on_menukey_script != "")
    writer->write_string("on-menukey-script", on_menukey_script);

  for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i) {
    Sector* sector = *i;
    writer->start_list("sector");
    sector->write(*writer);
    writer->end_list("sector");
  }

  writer->end_list("supertux-level");

  delete writer;
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:28,代码来源:level.cpp

示例15: getFileList

int getFileList(const string& path, vector<string>& fl, Sector& client, unsigned int thresh)
{
   SNode attr;
   if (client.stat(path.c_str(), attr) < 0)
      return -1;

   if (attr.m_bIsDir)
   {
      vector<SNode> subdir;
      client.list(path, subdir);

      for (vector<SNode>::iterator i = subdir.begin(); i != subdir.end(); ++ i)
      {
         if (i->m_bIsDir)
            getFileList(path + "/" + i->m_strName, fl, client, thresh);
         else if ((i->m_sLocation.size() < thresh) && (int(i->m_sLocation.size()) < i->m_iReplicaNum))
            fl.push_back(path + "/" + i->m_strName);
      }
   }
   else if ((attr.m_sLocation.size() < thresh) && (int(attr.m_sLocation.size()) < attr.m_iReplicaNum))
   {
      fl.push_back(path);
   }

   return fl.size();
}
开发者ID:deniskin82,项目名称:sector-sphere,代码行数:26,代码来源:replicate.cpp


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